如何在 ListView 周围放置边框? [英] How do you put a border around a ListView?

查看:40
本文介绍了如何在 ListView 周围放置边框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的列表视图周围放置一个宽度为几个像素的边框.我希望它绕过整个列表视图.我怎样才能做到这一点?谢谢

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

推荐答案

为此,首先采用 LinearLayout 并为该线性布局分配一些颜色,然后采用该线性布局中的列表视图.为列表视图设置 android:layout_margin="10dp" 属性.这意味着在所有 4 个边上都会留下 10dp 的空间.这显示为列表视图的边框.

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.

这篇关于如何在 ListView 周围放置边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆