Android第1-2周作业

作业1:安装环境,截图编程界面,截图运行界面

 

 

 

 2.九宫格

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     xmlns:tools="http://schemas.android.com/tools"
 4     android:layout_width="match_parent"
 5     android:layout_height="match_parent"
 6     tools:context=".MainActivity">
 7 
 8     <View
 9         android:id="@+id/V_1"
10         android:layout_width="100dp"
11         android:layout_height="100dp"
12         android:background="#FF1100"
13         android:layout_centerInParent="true"/>
14 
15     <View
16         android:id="@+id/V_2"
17         android:layout_width="100dp"
18         android:layout_height="100dp"
19         android:background="#00FDE6"
20         android:layout_above="@+id/V_1"
21         android:layout_toLeftOf="@+id/V_1"/>
22 
23     <View
24         android:id="@+id/V_3"
25         android:layout_width="100dp"
26         android:layout_height="100dp"
27         android:background="#5700FF"
28         android:layout_above="@id/V_1"
29         android:layout_toRightOf="@id/V_2"/>
30 
31     <View
32         android:id="@+id/V_4"
33         android:layout_width="100dp"
34         android:layout_height="100dp"
35         android:background="#89FF00"
36         android:layout_above="@id/V_1"
37         android:layout_toRightOf="@id/V_3"/>
38 
39     <View
40         android:id="@+id/V_5"
41         android:layout_width="100dp"
42         android:layout_height="100dp"
43         android:background="#000000"
44         android:layout_below="@id/V_2"
45         android:layout_toLeftOf="@id/V_1"/>
46 
47     <View
48         android:id="@+id/V_6"
49         android:layout_width="100dp"
50         android:layout_height="100dp"
51         android:background="#D8F800"
52         android:layout_below="@id/V_4"
53         android:layout_toRightOf="@id/V_1"/>
54 
55     <View
56         android:id="@+id/V_7"
57         android:layout_width="100dp"
58         android:layout_height="100dp"
59         android:background="#00FF09"
60         android:layout_below="@id/V_5"
61         android:layout_toLeftOf="@id/V_1"/>
62 
63     <View
64         android:id="@+id/V_8"
65         android:layout_width="100dp"
66         android:layout_height="100dp"
67         android:background="#0696F8"
68         android:layout_below="@id/V_1"
69         android:layout_toRightOf="@id/V_7"/>
70 
71     <View
72         android:id="@+id/V_9"
73         android:layout_width="100dp"
74         android:background="#AA2B21"
75         android:layout_height="100dp"
76         android:layout_below="@id/V_1"
77         android:layout_toRightOf="@id/V_8"/>
78 
79 </RelativeLayout>

 

 作业3:布局界面(QQ群截图)

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent"
 5     android:background="#FFFFFF"
 6     android:layout_margin="10dp"
 7     android:orientation="vertical">
 8 
 9     <LinearLayout
10         android:layout_width="match_parent"
11         android:layout_height="0dp"
12         android:layout_weight="1"
13         android:background="#F7D800"/>
14 
15     <LinearLayout
16         android:layout_width="match_parent"
17         android:layout_height="0dp"
18         android:layout_weight="4"
19         android:background="#0000FF0D"
20         android:orientation="horizontal">
21 
22         <View
23             android:layout_width="0dp"
24             android:layout_height="match_parent"
25             android:layout_weight="1"
26             android:background="#31FF00"/>
27 
28         <View
29             android:layout_width="0dp"
30             android:layout_height="match_parent"
31             android:layout_weight="4"
32             android:background="#02FF5722"/>
33 
34         <View
35             android:layout_width="0dp"
36             android:layout_height="match_parent"
37             android:layout_weight="1"
38             android:background="#00FF0E"/>
39 
40     </LinearLayout>
41 
42     <LinearLayout
43         android:layout_width="match_parent"
44         android:layout_height="0dp"
45         android:layout_weight="1"
46         android:background="#FDDA00"/>
47 
48 </LinearLayout>

 

posted @ 2021-09-18 17:55  欧阳晨  阅读(7)  评论(0编辑  收藏  举报