Share Coding

Tutorials, Problems, Stuffs …

Tag Archives: imageview border

Set Border to Android ImageView

Create a layout xml file in res/drawable:

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFFFFF" />
<stroke android:width="1dp" android:color="#000000" />
<padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp" /></shape>

 
Add the background to imageview:

android:background="@drawable/xmlFileName"

 
By programmatically:

imageview.setBackgroundResource(R.drawable.xmlFileName);