1.LinearLayout—线性布局
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:text="按钮"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
android:layout_width //定义width
android:layout_height //定义height
math_parent //继承父组件的width、height
wrap_content //组件实际的大小
1.1线性布局中可以嵌套
//两个并排显示
<LinearLayout
android:background="#333"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:background="#333"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="match_parent"></LinearLayout>
<LinearLayout
android:background="#fff"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="match_parent"></LinearLayout>
</LinearLayout>
2.GridLayout
//一行四个
<GridLayout
android:columnCount="4"
android:rowCount="3"
android:layout_width="match_parent"
android:layout_height="300dp"
tools:context="MissingConstraints"
>
<Button />
<Button />
<Button />
<Button />
<Button />
<Button />
<Button />
<Button />
</GridLayout>