1.LinearLayout
2.RelativeLayout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="150dp">
<TextView
android:id="@+id/tv_center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:text="我在中间"
android:layout_centerInParent="true"
android:textSize="11sp"
android:textColor="#000000"/>
<TextView
android:id="@+id/tv_center_hor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:text="我在水平中间"
android:layout_centerHorizontal="true"
android:textSize="11sp"
android:textColor="#000000"/>
<TextView
android:id="@+id/tv_center_ver"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:text="我在垂直中间"
android:layout_centerVertical="true"
android:textSize="11sp"
android:textColor="#000000"/>
<TextView
android:id="@+id/tv_parent_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:text="我在上级左边对齐"
android:layout_alignParentLeft="true"
android:textSize="11sp"
android:textColor="#000000"/>
<TextView
android:id="@+id/tv_parent_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:text="我在上级右边对齐"
android:layout_alignParentRight="true"
android:textSize="11sp"
android:textColor="#000000"/>
<!-- 在中间textview的左边-->
<TextView
android:id="@+id/tv_left_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:text="我在中间左边"
android:layout_alignTop="@id/tv_center"
android:layout_toLeftOf="@id/tv_center"
android:textSize="11sp"
android:textColor="#000000"/>
<TextView
android:id="@+id/tv_right_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:text="我在中间右边边"
android:layout_alignTop="@id/tv_center"
android:layout_toRightOf="@id/tv_center"
android:textSize="11sp"
android:textColor="#000000"/>
<TextView
android:id="@+id/tv_above_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:text="我在中间上边"
android:layout_alignLeft="@id/tv_center"
android:layout_above="@id/tv_center"
android:textSize="11sp"
android:textColor="#000000"/>
<TextView
android:id="@+id/tv_below_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:text="我在中间上边"
android:layout_alignLeft="@id/tv_center"
android:layout_below="@id/tv_center"
android:textSize="11sp"
android:textColor="#000000"/>
</RelativeLayout>
3.GridLayout
<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="2"
android:rowCount="2">
<TextView
android:layout_width="0dp"
android:layout_columnWeight="1"
android:layout_height="180dp"
android:background="#ffcccc"
android:gravity="center"
android:text="浅红色"
android:textAlignment="center"
android:textColor="#000000"
android:textSize="17sp"/>
<TextView
android:layout_width="0dp"
android:layout_columnWeight="1"
android:layout_height="180dp"
android:background="#ffaa00"
android:text="橙色"
android:gravity="center"
android:textColor="#000000"
android:textSize="17sp"/>
<TextView
android:layout_width="0dp"
android:layout_columnWeight="1"
android:layout_height="60dp"
android:background="#ffcccc"
android:text="浅红色"
android:gravity="center"
android:textColor="#000000"
android:textSize="17sp"/>
<TextView
android:layout_width="0dp"
android:layout_columnWeight="1"
android:layout_height="60dp"
android:background="#ffaa00"
android:text="橙色"
android:gravity="center"
android:textColor="#000000"
android:textSize="17sp"/>
</GridLayout>
4.ScrollView
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="200dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<View
android:layout_width="300dp"
android:layout_height="match_parent"
android:background="@color/green"/>
<View
android:layout_width="300dp"
android:layout_height="match_parent"
android:background="@color/black"/>
<View
android:layout_width="300dp"
android:layout_height="match_parent"
android:background="#a12311"/>
<View
android:layout_width="300dp"
android:layout_height="match_parent"
android:background="#9C27B0"/>
<View
android:layout_width="300dp"
android:layout_height="match_parent"
android:background="#FFEB3B"/>
</LinearLayout>
</HorizontalScrollView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="@color/green"/>
<View
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="@color/black"/>
<View
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="#a12311"/>
<View
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="#9C27B0"/>
<View
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="#FFEB3B"/>
</LinearLayout>
</ScrollView>
</LinearLayout>