关于LinearLayout与RelativeLayout两种布局+其中用到的一些属性
1.Linearlayout
线性布局:vertical:垂直排列;horizontal:水平排列
通过android:orientation属性指定,不指定则默认horizontal
android:gravity ---指定文字在控件中的对齐方式
android:layout_gravity --- 指定控件在布局中的对齐方式
(top;center_vertical;center_horizontal;bottom)
android_weight:通过比例指定控件大小
2.Relativelayout
相对布局
相对于父布局:layout_alignParentLeft;Layout_alignParentTop;layout_alignParentRight;layout_alignParentBottom;layout_centerInParent
相对于控件:使用示例:android:layout_below="@id/button3"
layout_above;layout_below;layout_toLeftOf;layout_toRightOf;layout_alignLeft;layout_alignRight;layout_alignTop;layout_alignBottom
注:这两种布局一般嵌套使用

浙公网安备 33010602011771号