四舍五入的图像绘制对象只绘制白色
问题描述:
我下面从罗曼盖伊四舍五入的图像教程,四舍五入的图像绘制对象只绘制白色
http://www.curious-creature.com/2012/12/11/android-recipe-1-image-with-rounded-corners/
我提取的绘制一类RoundedDrawable
但是当我尝试并使用它的位图,它会总是涂成白色。
我该如何解决这个问题?
答
这里有一个简单的方法
添加此对您的build.gradle compile 'de.hdodenhof:circleimageview:2.1.0'
并在您的XML添加
<de.hdodenhof.circleimageview.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/profile_image"
android:layout_width="your size"
android:layout_height="your size"
android:src="@drawable/profile"
app:civ_border_width="2dp"
app:civ_border_color="#FF000000"/>
有更好的方法来创建圆形图片,你不应该使用这种方法了。 https://*.com/a/26471808/599346 – tyczj
@tyczj该方法不适用于我。甚至没有加载位图= / – 1tSurge