CircleImageView仅支持来自xml src android的图像
我正在使用android应用程序中填充圆形图像。但是在使用示例项目后,我发现了圆形图像,使用以下代码从xml设置:-CircleImageView仅支持来自xml src android的图像,android,imageview,Android,Imageview,我正在使用android应用程序中填充圆形图像。但是在使用示例项目后,我发现了圆形图像,使用以下代码从xml设置:- <com.mikhaellopez.circularimageview.CircularImageView android:id="@+id/circleImgView" android:layout_width="250dp" android:layout_height="250dp" android:src="@drawable/imag
<com.mikhaellopez.circularimageview.CircularImageView
android:id="@+id/circleImgView"
android:layout_width="250dp"
android:layout_height="250dp"
android:src="@drawable/image"
app:border="true"
app:border_color="@color/GrayLight"
app:border_width="10"
app:shadow="true" />
我需要使用java编程设置图像。但这样做是行不通的 您到底想做什么?我想使用setBackgroundResource方法从java编程设置图像。但是当我使用imgView.setBackgroundResource(R.drawable.image)时,图像保持不变。圆圈视图效果不起作用。1-要更改te bg还是src?2-
R.drawable.image
与@drawable/image
3-仍然不清楚您想做什么。。。还要注意,setBackgroundResource已经过时,因为JELLY_BEAN(使用API级别16的setBackground+)谢谢您,先生!找到解决办法了。使用imgView.setImageResource(R.drawable.image)它可以工作!不客气,先生。因此,您想要更改的是src
。谜团解开了。
imgView = (CircularImageView)findViewById(R.id.circleImgView);
imgView.setBackgroundResource(R.drawable.image);