参考设计图:
实验成果:
采用了线性布局与相对布局
实验代码:
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#EED2EE"
tools:context=".MainActivity">
//第0层
android:id = "@+id/li_0"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
android:orientation="horizontal"
android:layout_margin="10dp"
>
//第1层
android:id = "@+id/li_1"
android:layout_width="match_parent"
android:layout_height="150dp"
android:orientation="horizontal"
android:padding="7dp">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:background="#EE799F" />
//第2层
android:id="@+id/li_2"
android:layout_width="match_parent"
android:layout_height="90dp"
android:orientation="horizontal"
>
android:layout_width="80dp"
android:layout_height="match_parent"
android:background="#BCD2EE"
android:layout_margin="8dp"
/>
android:layout_width="80dp"
android:layout_height="match_parent"
android:background="#BCD2EE"
android:layout_margin="8dp"
/>
android:layout_width="80dp"
android:layout_height="match_parent"
android:background="#BCD2EE"
android:layout_margin="8dp"
/>
android:layout_width="80dp"
android:layout_height="match_parent"
android:background="#BCD2EE"
android:layout_margin="8dp"
/>
>//第3层
android:id = "@+id/li_3"
android:layout_width="match_parent"
android:layout_height="200dp"
android:padding="7dp">
android:id="@+id/view_1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white"
android:layout_margin="10dp"/>
android:id="@+id/view_2"
android:layout_width="120dp"
android:layout_height="match_parent"
android:background="#66ff33"
android:layout_below="@id/view_1"
android:layout_margin="10dp"/>
android:id="@+id/view_3"
android:layout_width="120dp"
android:layout_height="130dp"
android:background="#66ff33"
android:layout_below="@id/view_1"
android:layout_toRightOf="@id/view_2"
android:layout_margin="10dp"/>
android:layout_width="120dp"
android:layout_height="match_parent"
android:background="#66ff33"
android:layout_below="@id/view_1"
android:layout_toRightOf="@id/view_3"
android:layout_margin="10dp"/>
原文:https://www.cnblogs.com/fefll/p/14728472.html