只需要在你的drawable中建立一个名bg-border的资源文件即可
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#EEEEEE" />
<stroke android:width="3dp" android:color="#EEEEEE" />
<corners android:radius="0dp" />
<padding android:left="0dp" android:top="0dp"
android:right="0dp" android:bottom="0dp" />
</shape>
在Imageview定义页面上使用代码:
<ImageView
android:id="@+id/img"
android:background="@drawable/bg_border"
android:src="@mipmap/ic_launcher"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />