关于android中的两大布局LinearLayout、RelativeLayout
2017-12-17 22:51
537 查看
、:
LinearLayout是线性布局控件,它包含的子控件将以横向或竖向的方式排列,按照相对位置来排列所有的widgets或者其他的containers,超过边界时,某些控件将缺失或消失。因此一个垂直列表的每一行只会有一个widget或者是container,而不管
他们有多宽,而一个水平列表
将会只有一个行高(高度为最高子控件的高度加上边框高度)。LinearLayout保持其所包含的widget或者是container之间的间隔以及互相对齐
(相对一个控件的右对齐、中间对齐或者左对齐)。
LinearLayout的常用属性:
1.android:orientation 定义布局内控件或组件的排列方式
RelativeLayout:
指按着控件之间的相对位置来进行布局。RelativeLayout是一个允许子视图相对于其他兄弟视图或是父视图显示的视图组(通过ID指定)。
每个视图的位置能够指定它相对于兄弟(比如在其他视图的左边或是下边)或是父视图(这里是指相对布局容器,
比如底部对齐、中间偏左)的位置。
RelativeLayout特有属性:
1、android:gravity 设置布局容器内子控件的对齐方式
2、android:ignoreGravity="id" 设置布局管理器内哪个控件不受gravity属性的影响
相关文章推荐
- android LinearLayout和RelativeLayout实现精确布局
- 浅谈Android五大布局——LinearLayout、FrameLayout、AbsoulteLayout、RelativeLayout、TableLayout
- 用android LinearLayout和RelativeLayout实现精确布局
- Android两大布局:线性布局(LinearLayout) 相对布局(RelativeLayout)
- Android应用的LinearLayout中嵌套RelativeLayout的布局用法
- 用android LinearLayout和RelativeLayout实现精确布局(转)很适合新人看
- 用android LinearLayout和RelativeLayout实现精确布局
- Android学习日志07__五大布局01__LinearLayout & RelativeLayout
- Android UI设计的三种常见布局(LinearLayout、RelativeLayout、FrameLayout)
- android LinearLayout和RelativeLayout实现精确布局
- android的常用布局LinearLayout和RelativeLayout
- 安卓学习第三弹--关于布局文件LinearLayout和RelativeLayout的那点事
- 用android LinearLayout和RelativeLayout实现精确布局
- android LinearLayout和RelativeLayout实现精确布局
- (转)浅谈Android五大布局——LinearLayout、FrameLayout、AbsoulteLayout、RelativeLayout和TableLayout
- Android 布局之LinearLayout和RelativeLayout
- 关于android LinearLayout的比例布局(转载)
- android 线性布局LinearLayout 和 相对布局RelativeLayout
- 转)浅谈Android五大布局——LinearLayout、FrameLayout、AbsoulteLayout、RelativeLayout和TableLayout
- Android五种布局方式——LinearLayout、RelativeLayout、TableLayout....(四)