第1次作业
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 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" tools:context=".MainActivity"> <View android:id="@+id/V_1" android:layout_width="100dp" android:layout_height="100dp" android:background="#99000000" android:layout_centerInParent="true"/> <View android:id="@+id/V_2" android:layout_width="100dp" android:layout_height="100dp" android:background="#4CA3AF" android:layout_above="@+id/V_1" android:layout_toLeftOf="@+id/V_1"/> <View android:id="@+id/V_3" android:layout_width="100dp" android:layout_height="100dp" android:background="#FF3B90" android:layout_above="@id/V_1" android:layout_toRightOf="@id/V_2"/> <View android:id="@+id/V_4" android:layout_width="100dp" android:layout_height="100dp" android:background="#2196F3" android:layout_above="@id/V_1" android:layout_toRightOf="@id/V_3"/> <View android:id="@+id/V_5" android:layout_width="100dp" android:layout_height="100dp" android:background="#FF5722" android:layout_below="@id/V_2" android:layout_toLeftOf="@id/V_1"/> <View android:id="@+id/V_6" android:layout_width="100dp" android:layout_height="100dp" android:background="#FFE222" android:layout_below="@id/V_4" android:layout_toRightOf="@id/V_1"/> <View android:id="@+id/V_7" android:layout_width="100dp" android:layout_height="100dp" android:background="#673AB7" android:layout_below="@id/V_5" android:layout_toLeftOf="@id/V_1"/> <View android:id="@+id/V_8" android:layout_width="100dp" android:layout_height="100dp" android:background="#2196F3" android:layout_below="@id/V_1" android:layout_toRightOf="@id/V_7"/> <View android:id="@+id/V_9" android:layout_width="100dp" android:background="#8BC34A" android:layout_height="100dp" android:layout_below="@id/V_1" android:layout_toRightOf="@id/V_8"/> </RelativeLayout>
<?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:background="#FFFFFF" android:layout_margin="10dp" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:background="#4CAF50"/> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="4" android:background="#0000FF0D" android:orientation="horizontal"> <View android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:background="#2196F3"/> <View android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="4" android:background="#02FF5722"/> <View android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:background="#2196F3"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:background="#4CAF50"/>