my_border.xml
-------------------
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="1dp" android:color="#cdcdcd" />
<solid android:color="#ffffff" />
<padding android:left="2dp" android:top="2dp"
android:right="2dp" android:bottom="2dp" />
<corners android:radius="15dip"/>
</shape>
--------------------------------------------------------------------------
or
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="#FFF"
/>
<corners
android:radius="10dip"
/>
<stroke
android:width="5dip"
android:color="#555"
/>
</shape>
-----------
listView.setBackgroundResource(R.layout.my_border);
-------------------
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="1dp" android:color="#cdcdcd" />
<solid android:color="#ffffff" />
<padding android:left="2dp" android:top="2dp"
android:right="2dp" android:bottom="2dp" />
<corners android:radius="15dip"/>
</shape>
--------------------------------------------------------------------------
or
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="#FFF"
/>
<corners
android:radius="10dip"
/>
<stroke
android:width="5dip"
android:color="#555"
/>
</shape>
-----------------------------------------------------------------------------------------
java code-----------
listView.setBackgroundResource(R.layout.my_border);
No comments:
Post a Comment