关于android LinearLayout的比例布局
16lz
2021-12-04
关于android LinearLayout的比例布局
分类: android 2012-12-27 19:20 1015人阅读 评论(0) 收藏 举报关于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 >
更多相关文章
- Android引路蜂地图开发示例:基本知识
- Android引路蜂地图开发示例:基本知识
- Android引路蜂地图开发示例:基本知识
- Android(安卓)textView字间距自定义LetterSpacingTextView
- ArcGIS for Android地图控件的5大常见操作
- 如何在Android中取得当前进程名
- android 布局文件 layout_weight用法
- Android(安卓)ActionBar 作为导航条的一个Bug
- Android(安卓)自定义View及其在布局文件中的使用示例(三):结合An