关于android LinearLayout的比例布局

分类: android 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,给个示例如下:

<LinearLayout
android: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 >

更多相关文章

  1. Android引路蜂地图开发示例:基本知识
  2. Android引路蜂地图开发示例:基本知识
  3. Android引路蜂地图开发示例:基本知识
  4. Android(安卓)textView字间距自定义LetterSpacingTextView
  5. ArcGIS for Android地图控件的5大常见操作
  6. 如何在Android中取得当前进程名
  7. android 布局文件 layout_weight用法
  8. Android(安卓)ActionBar 作为导航条的一个Bug
  9. Android(安卓)自定义View及其在布局文件中的使用示例(三):结合An

随机推荐

  1. 相对布局属性
  2. android lisetview的多列模版
  3. android 3G pppd 调试记录。
  4. Android证书创建之 keytool 错误:java.io.
  5. 【Android】自带Theme
  6. Android通过源码编译apk获得系统权限
  7. Android几种动画的总结(MaterialAnimatio
  8. Android(安卓)layout布局属性、标签属性
  9. No resource found that matches the giv
  10. Android使用MediaCodec将YUV硬编成H264