(1)match_parent:指占满父容器此时要控件的宽或高等于父容器的宽或高。
(2)wrap_content和的用法:指控件的高或宽随内容的长度决定。
(3)设置固定值,可以是30dp,也可以是120dp,想要设置为0dp,必须有weight属性,且值不为0才可以。
<LinearLayout android:background="@color/white" android:layout_width="match_parent" android:layout_height="100dp" android:orientation="horizontal"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content"/></LinearLayout>
效果图:case1.png(2)第二种情况:<LinearLayout android:background="@color/white" android:layout_width="match_parent" android:layout_height="100dp" android:orientation="horizontal"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content"/> <Button android:layout_width="match_parent" android:layout_height="w(spc是什么意思?spc即统计过程控制(Statistical Process Control),是一种借助数理统计方法的过程控制工具。)rap_content"/></LinearLayout>
效果图:case2.png(3)第三种情况:<LinearLayout android:background="@color/white" android:layout_width="match_parent" android:layout_height="100dp" android:orientation="horizontal"> <Button android:layout_width="wrap_content" android:layout_height="match_parent"/> <Button android:layout_width="match_parent" android:layout_height="wrap_content"/></LinearLayout>
效果图:case3.png(4)第四种情况:<LinearLayout android:background="@color/white" android:layout_width="match_parent" android:layout_height="100dp" android:orientation="horizontal"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content"/> <Button android:layout_width="match_parent" android:layout_height="match_parent"/></LinearLayout>
效果图:case4.png(5)第五种情况:<LinearLayout android:background="@color/white" android:layout_width="match_parent" android:layout_height="100dp" android:orientation="horizontal"> <Button android:text="Btn1" android:layout_width="match_parent" android:layout_height="wrap_content" /> <Button android:text="Btn2" android:layout_width="match_parent" android:layout_height="wrap_content"/> </LinearLayout>
效果图:case5.png(6)第六种情况:<LinearLayout android:background="@color/white" android:layout_width="match_parent" android:layout_height="100dp" android:orientation="horizontal"> <Button android:text="Btn1" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" /> <Button android:text="Btn2" android:layout_width="match_parent" android:layout_height="wrap_content"/></LinearLayout>
效果图:case6.png设置比重时需要改为0dp的问题而当我们使用到比重的时候,会在代码中有提示:让我们将layout_width的值设置为0dp
<LinearLayout android:background="@color/white" android:layout_width="match_parent" android:layout_height="100dp" android:orientation="horizontal"> <Button android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" /> <Button android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content"/></LinearLayout>
效果图:均分铺满case7.png而如果我们的布局如下:将layout_width的值设置为wrap_content<LinearLayout android:background="@color/white" android:layout_width="match_parent" android:layout_height="100dp" android:orientation="horizontal"> <Button android:layout_width="wrap_content" android:layout_weight="1" android:layout_he
扫码加微信详细咨询太和智慧养老产品和平台服务!
版权声明:
---------------------------------------------------------------
所有信息来源于互联网,本文的版权归原作者所有,不代表本网观点和立场。
本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,请发送邮件至 81480447@qq.com 举报,一经查实,本站将立刻删除。
扫码加微信详细咨询太和智慧养老产品和平台服务!
养老资讯
- 骁骑校尉是何职相当于现在
- 关于红楼梦中贾母?《红楼
- 明朝朱棣的皇后 叫什么
- 包青天是哪个朝代的人?黄
- 关于小说《大唐双龙传》中
- 非洲原始部落女人?非洲原
- 消逝的光芒有那些武器?蛊
- 魏襄王为什么又叫叫梁襄王
- 世界上最瘦的人叫什么?世
- 我需要所有的天体海滩的名
- 唐朝徐敬业为什么那么快兵
- 我想知道~程咬金有什么封
- 恐龙的历史资料?关于恐龙
- 天龙八部 阿朱和阿紫名字
- 求纳兰容若的爱情词?纳兰
- 霍去病怎么死的?崇信县嘉
- 蒙古人 歌词?蒙古人为什
- 《武林外史》中沈浪到底喜
- 世界上肌肉最强壮的人,身
- 楚国太子横是谁的儿子?楚
- 一阳指,六脉神剑和弹指神
- 关云长刮骨疗毒吕子明白衣
- 碧血书香梦 电视剧哪集吴
- 列宁的生平简介?秃发树机
- 汤显祖为何创作《牡丹亭》
- 巴黎 埃菲尔铁塔(简介)
- 琅琊榜里面的聂铎怎么变怪
- 刘备陵的刘备墓地之争?刘
- 为何在广西发现的建文帝墓
- 《鬼吹灯之黄皮子坟》结局
- 成也萧河败也萧何说的是谁
- 乌孜别克族饮食习俗及禁忌
- 琅琊榜中当年长公主是怎么
- 历史上明智光秀为什么背叛
- 魏襄王魏嗣是明君吗?魏国
- 历史上真实的“反清复明”
- 《西游记前传》牛魔王的来
- 大禹治水是民间传说,还是
- 刘邦手下大将谁最厉害 刘
- 米隆老爹的简介?法那斯米
助老机构介绍
姓名:
年龄:
电话: