带有圆角的Android ImageView无法正常工作

参见英文答案 > How to make an ImageView with rounded corners?40个
我已经定义了文件thumb_rounded.xml并将其放在我的android应用程序中的res / drawable文件夹中.有了这个文件,我想在我的ImageView中得到包含新闻拇指的圆角,
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners android:radius="13.0dip" />
</shape>

我将其设置为我的ImageView的背景,但是,我没有得到圆角,图像仍然是一个矩形.有没有人知道怎么做到这一点?我想达到与此屏幕相同的效果

非常感谢

Ť

解决方法

你缺少几个标签.这是一个新的样本:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> 
    <solid android:color="#ffffff"/>    

    <stroke android:width="3dp"
            android:color="#ff000000"/>

    <padding android:left="1dp"
             android:top="1dp"
             android:right="1dp"
             android:bottom="1dp"/> 

    <corners android:radius="30px"/> 
</shape>

看到here

另外,你知道RoundRectShape吗?

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...