android:layout_weight 属性对于组件长度的影响
<LinearLayout android:id="@+id/lnLayoutBottom" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" android:layout_weight="1" /> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" android:layout_weight="1" android:enabled="false"/> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" android:layout_weight="1" /> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" android:layout_weight="1" android:enabled="false"/> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" android:layout_weight="1" android:enabled="false"/> </LinearLayout>
如果 五个Button的android:layout_width 属性 设置为 "fill_parent" 则 在android:layout_weight 的影响下, 起五个button的长度将相等,
如果设置为 wrap_content , 则其长度不等。。。。。
更多相关文章
- Android(安卓)maxLines maxLength属性
- android main.xml分析。。一点点补充
- Android(安卓)EditText 限制文本框输入的长度和提示信息
- Android(安卓)textview 显示不全的问题
- Android(安卓)textview 显示不全的问题
- Android中的Margin和Padding及Android支持的长度单位
- Android(安卓)限制EditText只能输入数字、限制输入类型、限制输
- 如果Imageview与Linearlayout有叠加且可选资源长度不同,如何布局?
- android main.xml分析。。一点点补充