Android界面布局

-相对布局 RelativeLayout
-线性布局 LinearLayout
-公有属性

区分wrap_content和match_parent

_**warp_content**:自适应内容的大小
-match_parent:占据父容器的全部

公有属性

-layout_width 、layout_height
-layout_margin+方位
-padding +方位
-layout_gravity
-gravity

相对布局 RelativeLayout

属性(一定要给每一个控件设置id)

-toRightOf
-toLeftOf
-layout_below
代码

线性布局 LinearLayout

属性

android:orientation=”horizontal”/”vertical”——设置线性布局是水平还是垂直排列

权重可以把布局分成相等的几等分

 水平:
 android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content" 
垂直:
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="0dp"

代码

猜你喜欢

转载自blog.csdn.net/xxz2645746142/article/details/80565393