第四周Android

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     xmlns:app="http://schemas.android.com/apk/res-auto"
 4     xmlns:tools="http://schemas.android.com/tools"
 5     android:layout_width="match_parent"
 6     android:layout_height="match_parent"
 7     tools:context=".MainActivity">
 8 
 9 
10     <Button
11         android:id="@+id/a1"
12         android:layout_width="100dp"
13         android:layout_height="100dp"
14         android:layout_centerInParent="true"
15         android:background="#67dcd2"
16         />
17 
18     <Button
19         android:id="@+id/a2"
20         android:layout_width="100dp"
21         android:layout_height="100dp"
22         android:layout_above="@id/a1"
23         android:layout_alignRight="@+id/a1"
24         android:background="#b44ff2"
25         />
26 
27     <Button
28         android:id="@+id/a3"
29         android:layout_width="100dp"
30         android:layout_height="100dp"
31         android:layout_below="@id/a1"
32         android:layout_alignRight="@+id/a1"
33         android:background="#b44ff2"
34         />
35 
36     <Button
37         android:id="@+id/a4"
38         android:layout_width="100dp"
39         android:layout_height="100dp"
40         android:layout_above="@id/a1"
41         android:layout_toLeftOf="@+id/a1"
42         android:background="#c36666"
43         />
44 
45     <Button
46         android:id="@+id/a5"
47         android:layout_width="100dp"
48         android:layout_height="100dp"
49         android:layout_above="@id/a1"
50         android:layout_toRightOf="@+id/a1"
51         android:background="#7CFC00"
52         />
53 
54     <Button
55         android:id="@+id/a6"
56         android:layout_width="100dp"
57         android:layout_height="100dp"
58         android:layout_below="@id/a1"
59         android:layout_toLeftOf="@+id/a1"
60         android:background="#303030"
61         />
62 
63     <Button
64         android:id="@+id/a7"
65         android:layout_width="100dp"
66         android:layout_height="100dp"
67         android:layout_below="@id/a1"
68         android:layout_toRightOf="@+id/a1"
69         android:background="#3941ff"
70         />
71 
72     <Button
73         android:id="@+id/a8"
74         android:layout_width="100dp"
75         android:layout_height="100dp"
76         android:layout_toLeftOf="@id/a1"
77         android:layout_alignBottom="@+id/a1"
78         android:background="#b44ff2"
79         />
80 
81     <Button
82         android:id="@+id/a9"
83         android:layout_width="100dp"
84         android:layout_height="100dp"
85         android:layout_toRightOf="@id/a1"
86         android:layout_alignBottom="@+id/a1"
87         android:background="#b44ff2"
88         />
89 
90 
91 
92 
93 </RelativeLayout>      

原文地址:https://www.cnblogs.com/919753740yu/p/13713798.html