LinearLayout内的权重属性 weight
来源:互联网 发布:财政部ppp中心数据 编辑:程序博客网 时间:2024/05/21 08:42
1、首先设置是横向还是纵向,如果是横向,设置横向width 都是0dp ,weight就是对应的权重,比如,两个按钮 权重分别是1,2,那么第一个按钮占得距离是1/3,第二个是2/3
2、如果对应的宽度或者高度是match,那么计算权重时需要首先计算出总长度或者总高度, 公式= 原宽度+剩余宽度的百分比
例如: 两个横向的按钮 宽度都是 match_parent ,权重分别是1,2 那么第一个按钮的距离=L+(L-2L)*(1/3)= 2/3L
3、如果三个控件使用权重,
android:baselineAligned="false"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:baselineAligned="false" android:orientation="horizontal"> <TextView android:background="#ff0000" android:gravity="center" android:layout_width="0dp" android:layout_height="45dp" android:layout_weight="1" android:text="abdcde/ncdd"/> <TextView android:background="#0f0" android:gravity="center" android:layout_width="0dp" android:layout_height="45dp" android:layout_weight="2" android:text="第二个"/> <TextView android:background="#00f" android:gravity="center" android:layout_width="0dp" android:layout_height="45dp" android:layout_weight="3" android:text="第三个"/></LinearLayout>
0 0
- LinearLayout内的权重属性 weight
- LinearLayout的weight(权重属性)
- 相对布局LinearLayout权重weight的用法
- 浅析LinearLayout的weight属性
- Android LinearLayout布局嵌套及权重weight的使用
- LinearLayout 子控件weight权重的作用详析
- 关于LinearLayout中的weight的属性
- LinearLayout中的weight属性的计算
- Android-LinearLayout的weight属性分配原则分析
- LinearLayout中的weight属性的计算
- LinearLayout 中的 weight 属性
- LinearLayout之weight属性
- 权重weight的使用
- LinearLayout的weight
- Android 布局之LinearLayout 子控件weight权重的作用详析
- Android 布局之LinearLayout 子控件weight权重的作用详析
- Android 布局之LinearLayout 子控件weight权重的作用详析
- Android 布局之LinearLayout 子控件weight权重的作用详析
- Linux下gcc编译生成动态链接库*.so文件并调用它
- Nodejs(六)
- iOS程序添加icon图标/启动画面的制作
- Add Two Numbers
- JAVA的synchronized关键字学习
- LinearLayout内的权重属性 weight
- More Effective C++----(8)理解各种不同含义的new和delete
- 对称加密与非对称加密
- 22.Eclipse 的 Java Web 项目环境搭建 - IntelliJ IDEA 使用教程
- 第一章 JAVA入门(下载安装JDK JRE)
- JVM类加载机制详解(一)JVM类加载过程
- 栈+括号配对 51Nod1478 括号序列的最长合法子段
- 获取客户端真实IP——request.getHeader("x-forwarded-for")
- 谷歌不再销售Nexus 9 Android平板