Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/218.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 带背景的图像视图半径_Android_Imageview - Fatal编程技术网

Android 带背景的图像视图半径

Android 带背景的图像视图半径,android,imageview,Android,Imageview,我有一个有背景的ImageView。我需要将边框半径设置为我的图像视图。我在另一个XML文件中使用下面的代码,并将其设置为android:src,但在设置背景时它不起作用 <shape xmlns:android="http://schemas.android.com/apk/res/android" > <corners android:radius="10dp"/> </shape> 如何同时设置背景和半径?您可以将背景与边界半径xml一起设置 &l

我有一个有背景的
ImageView
。我需要将
边框半径
设置为我的
图像视图
。我在另一个XML文件中使用下面的代码,并将其设置为
android:src
,但在设置背景时它不起作用

<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<corners android:radius="10dp"/>
</shape>


如何同时设置背景和半径?

您可以将背景与边界半径xml一起设置

<shape xmlns:android="http://schemas.android.com/apk/res/android" >
   <corners android:radius="10dp"/>
   <!-- background -->
   <solid android:color="@android:color/white" />
</shape>


由于您使用的是android:src,所以在设置为ImageView时必须提供位图的半径,我不需要背景色。我需要我的照片作为背景。