layout_weight的简单用法
来源:互联网 发布:网络安全管理责任制度 编辑:程序博客网 时间:2024/06/16 04:15
有时候老在xml文件里遇到layout_weight,不太明白它的用法,就在网上搜了搜,发现有篇文章写得不错,浅显易懂
地址:http://blog.csdn.net/hytfly/article/details/8520617
layout_weight是线性布局,也就是在LinearLayout里才会用到。它与layout_width有关。
1.当layout_width=“fill_parent”的时候,weight的值越小,它占的比重反而大。
如:button_1的layout_weight=“1”,button_2的layout_weight=“2”,那么,button_1占2/3,button_2占1/3。
得出结论:在layout_width设置为fill_parent的时候,layout_weight代表的是你的控件要优先尽可能的大,但尽可能大是有限度的,即fill_parent.
2.当layout_width=“wrap_content”的时候,weight的值越小,它占的比重也小。
如:button_1的layout_weight=“1”,button_2的layout_weight=“2”,那么,button_1占1/3,button_2占2/3。
在layout_width设置为wrap_content的时候,layout_weight代表的是你的控件要优先尽可能的小,但这个小是有限度的,即wrap_content.
如图:若有需要将页面分成三部分,将layout_width=“fill_parent”,按照如上weight的比例即可实现。
- layout_weight的简单用法
- Android:layout_weight的用法
- android:layout_weight的用法
- android:layout_weight的用法
- layout_weight 不常用的用法
- 关于layout_weight="1"的用法
- Android:layout_weight属性的两种用法
- Android之权重layout_weight的真正用法
- Android布局之layout_weight的用法
- andoird中layout_weight用法
- Android layout_weight用法图解
- android:layout_weight 用法解释
- android layout_weight 用法
- Android layout_weight用法详解
- android:layout_weight总有你不知道的用法.
- weightSum属性和layout_weight属性的用法和详解
- Android面试中的一个常见问题:Layout_weight的用法
- android:layout_weight总有你不知道的用法
- 【实验一】跑马灯实验
- ionic将ionicLoading与http请求绑定
- 让思路更清晰——我是怎样使用思维导图的
- 利用Squid反向代理搭建CDN缓存服务器加快Web访问速度
- instanceof() VS isPrototypeOf() hasOwnProperty() VS propertyIsEnumerable()
- layout_weight的简单用法
- 刨根问底Objective-C Runtime
- [java03]java字符串
- 泛型类型编写
- static_cast与dynamic_cast的比较
- 阿里RDS开发专家解析MySQL各版本并行复制
- linux应用程序小型化
- linux下eclipse cdt引用函数库设置问题
- redis in ruby 存取hash