android UI设计 layout_weight解析
来源:互联网 发布:淘宝一元拍入口 编辑:程序博客网 时间:2024/05/16 15:18
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Detail" style="?android:listSeparatorTextViewStyle"/> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" > <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="Wed Oct 17 15:49:50 EDT 2012"/> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="solved"/> </LinearLayout></LinearLayout>
效果图:
如果把android:layout_weight=”1”改为android:layout_weight=”0”
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Detail" style="?android:listSeparatorTextViewStyle"/> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" > <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0" android:text="Wed Oct 17 15:49:50 EDT 2012"/> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0" android:text="solved"/> </LinearLayout></LinearLayout>
效果图:
让LinearLayout只考虑android:layout_weight来分配空间,令android:layout_weight=”0”,这时候控件等分。
而android:layout_weight=”1”,会结合android:layout_width和android:layout_weight来划分控件,所以第一张图Button内容多,区域也就占得多。
0 0
- android UI设计 layout_weight解析
- Android UI杂谈---layout_weight
- android UI布局设计 —— layout_weight浅见
- android layout_weight难点解析
- Android:Layout_weight属性解析
- Android:Layout_weight解析(转)
- Android 布局之layout_weight解析
- Android布局之Layout_weight属性解析
- Android LinearLayout布局中 layout_weight解析
- android layout_weight="0dp"原因解析
- Android-Layout_weight属性解析(慕课网笔记)
- Android学习笔记----layout_weight属性解析
- layout_weight解析
- 解析layout_weight
- Android布局设计中的layout_weight的学习
- android UI 之layout_weight 的解释及使用
- android:layout_weight
- android:layout_weight
- 《C++编程思想》第八章 内 联 函 数 (原书代码+知识点+习题+解答)
- pascal矩阵
- hdu 5312 Sequence(数学)
- 黑马程序员——IO流(一)
- php5.3以后各版本的特性(主要是整理一下面试用的)
- android UI设计 layout_weight解析
- 使用mciSendCommand循环播放音乐
- 如何在Android Gradle中添加原生so文件依赖
- D - BestCoder Sequence
- MATLAB格式化输出控制
- CSS布局——元素浮动与定位篇
- hilbert矩阵
- 实战算法策略
- java设计模式之装饰模式