1. 在drawable新建一个drawable resource file,如下图所示
2. 在里面添加上下面代码
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="8dp" />
<solid android:color="@color/lightGrey" />
<stroke
android:width="1dp"
android:color="@color/colorPrimary" />
</shape>
3.指定imageview的background为这个drawable resource file