关于android LinearLayout的比例布局
16lz
2021-12-04
关于android LinearLayout的比例布局,主要有以下三个属性需要设置:
1,android:layout_width,android:layout_height,android:layout_weight三个值
2,当为水平布局时,android:layout_height=“0dp",当为垂直布局时,android:layout_width="0dp",android:layout_weight为所占比重。
3,给个示例如下:
< LinearLayoutandroid:orientation ="horizontal"
android:layout_width ="fill_parent"
android:layout_height ="fill_parent"
android:layout_weight ="1" >
< TextView
android:layout_width ="0dp"
android:layout_height ="fill_parent"
android:layout_weight ="1"
android:background ="#aa0000"
android:gravity ="center"
android:text ="1111111111111111111111111111111111111111111" />
< TextView
android:layout_width ="0dp"
android:layout_height ="fill_parent"
android:layout_weight ="2"
android:background ="#00aa00"
android:gravity ="center"
android:text ="2" />
< TextView
android:layout_width ="0dp"
android:layout_height ="fill_parent"
android:layout_weight ="3"
android:background ="#0000aa"
android:gravity ="center"
android:text ="3" />
</ LinearLayout > 效果:
原文摘自:http://blog.csdn.net/winson_jason/article/details/8444958
更多相关文章
- android view 局部刷新
- Android(安卓)自带图标库 (android.R.drawable)
- Android(安卓)Contacts(一)—— 读取联系人
- Android(安卓)ApiDemos示例解析(145):Views->Layouts->LinearLay
- Android(安卓)组件长宽比重设置总结
- Android开发——控件基础(五)RadioButton组件:属性、示例代码
- Android(安卓)组件长宽比重设置总结
- Android(安卓)组件长宽比重设置总结
- 关于android LinearLayout的比例布局