一、线性布局LinearLayout
orientation属性为horizontai时,水平方向从左到右
orientation属性为vertical时,垂直方向从上往下
(不指定默认水平)
layout_weight代表着在布局中的占比
自己尝试了一下
二、相对布局RelativeLayout
相对布局下级视图位置由其他视图决定,用于确定下级视图的参照物
- 与视图自身平级的视图
- 该视图上级视图
如果不设定下级参照物,默认在内部左上角
实践:
三、网格布局GridLayout
支持多行多列表格排列,默认从左到右从上到下
columnCount:列数
rowCount:行数
cloumnWeight、rowWeight=列、行的权重
四、滚动视图ScrollView
ScrollView:垂直方向滚动视图;layout_width设为match_content,layout_height为wrap_contect
HorizontalScrollView:水平方向滚动视图;layout_width设为wrap_contect,layout_height为match_content