线性布局LinearLayout

线性布局LinearLayout

 

1.认识LinearLayout

 六大布局(线性布局LinearLayout、表格布局TableLayout、相对布局RelativeLayout、
层布局FrameLayout、绝对布局AbsoluteLayout、网格布局GridLayout。)之一,

具有垂直方向与水平方向的布局方式,开发时使用较多

 

2.LinearLayout常用属性

  android:layout_gravity:指定该子元素在LinearLayout中的对齐方式。

  android:layout_weight:指定该子元素在LinearLayout中所占的权重。

  android:orientation:属性设置线性布局的方向,将值设置为horizontal表示行,设置为vertical表示列,默认为horizontal。

  android:layout_width:设置LinearLayout 的宽度。

  android:layout_height:设置LinearLayout 的高度。

 

3.LinearLayout源码

进入Android studio初始XML文件

 

 

 

 

使用线性布局 只用将其原始代码xmls之前的代码替换成LinearLayout即可

 

 

 

 

 

  

 

  

posted @ 2019-10-10 19:49  骚人文客  阅读(327)  评论(0编辑  收藏  举报