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
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
For this first take the LinearLayout and assign that linear layout with some color and take a list view in that linear layout. Set the
android:layout_margin="10dp"
property for list view . That means on all 4 sides 10dp space will be left. This shown as the border of the list view.Simplest way:
you may also do border like as
There is a much easier way to create borders and other graphic details on views.
You should use 9 Patch images.They allow you to create any sort of background you like including borders. The link explains all. To verify here is an image of a bordered list.
Here is an image of the 9 patch image I used to make that border.
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
then set it as the listview background