Listview in android
I want to make a border in every row开发者_开发技巧 of Listview . How to do this?
Assuming you want a border around the whole item, the simplest way would be to define a shape in XML and set it as the background for the root of your row's layout. If you're doing anything fancy, though, you'll probably want to just make a stretchable nine-patch for it. Also see ListView's divider
and dividerHeight
properties for the simple case where you just want to customize the line between list items.
i found the answer just include the following shape.xml as a background for listview.
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="#003366"/>
<stroke android:width="1dp" android:color="#33CCFF"/>
<padding android:left="10dp" android:top="10dp"
android:right="10dp" android:bottom="10dp" />
</shape>
精彩评论