LinearLayout中使每个子控件均匀布局

来源:互联网 发布:linux groupadd 编辑:程序博客网 时间:2024/05/29 13:54
要想使LinearLayout布局中的每个子控件自动设置为相同大小,并均匀分布,可以在布局文件中设置layout_weight参数的值一致。

示例代码如下:

<LinearLayout    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:orientation="horizontal">    <TextView        android:id="@+id/txt_1"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_weight="1"/>    <TextView        android:id="@+id/txt_2"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_weight="1"/></LinearLayout>


阅读全文
0 0
原创粉丝点击