[英]Space buttons out evenly (horizontal)
I'm trying to space some buttons out across the display and have them be an equal distance apart. 我正在尝试在显示屏上隔开一些按钮,并使它们之间的距离相等。
Here's my view xml at the moment http://pastebin.com/DvURNWn3 这是我目前在http://pastebin.com/DvURNWn3上的视图xml
For each button, change this: 对于每个按钮,请更改此:
android:layout_width="0dp"
and set parent element's width fill_parent
or particular width as below : 并设置父元素的宽度
fill_parent
或特定宽度,如下所示:
android:layout_width="40dp"
It's good practice to set root element to RelativeLayout
instead of LinearLayout
since nested layout_weight
may throw Nested weights are bad for performance
warning. 将根元素设置为
RelativeLayout
而不是LinearLayout
是一个好习惯,因为嵌套的layout_weight
可能会抛出Nested weights are bad for performance
警告。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.