I would like to put a border around my listview that is a few pixes wide. I want it to to go around the entire listview piece. How can I do this? thanks
The other way to do it is to create a border resource that can then be reused, and it also means you won't need to create extra layout to implement it.
create a drawable resource
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <!-- use this for transparent --> <!-- <solid android:color="#00000000" /> --> <!-- use this for a background colour --> <solid android:color="#FFF" /> <stroke android:width="2dip" android:color="#FF0000" /> </shape>
then set it as the listview background
<ListView android:id="@id/android:list" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/border_ui" />
1.4m articles
1.4m replys
5 comments
57.0k users