Android第一、二周作业

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

作业2:九宫格

 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:id="@+id/ll_1"
 6     android:layout_width="match_parent"
 7     android:layout_height="match_parent"
 8     android:background="#FFFFFF">
 9 
10     <View
11         android:id="@+id/V_1"
12         android:layout_width="100dp"
13         android:layout_height="100dp"
14         android:background="#000000"
15         android:layout_centerInParent="true"/>
16 
17     <View
18         android:id="@+id/V_2"
19         android:layout_width="100dp"
20         android:layout_height="100dp"
21         android:background="#4CAF50"
22         android:layout_above="@+id/V_1"
23         android:layout_toLeftOf="@+id/V_1"/>
24 
25     <View
26         android:id="@+id/V_3"
27         android:layout_width="100dp"
28         android:layout_height="100dp"
29         android:background="#FFEB3B"
30         android:layout_above="@id/V_1"
31         android:layout_toRightOf="@id/V_2"/>
32 
33     <View
34         android:id="@+id/V_4"
35         android:layout_width="100dp"
36         android:layout_height="100dp"
37         android:background="#2196F3"
38         android:layout_above="@id/V_1"
39         android:layout_toRightOf="@id/V_3"/>
40 
41     <View
42         android:id="@+id/V_5"
43         android:layout_width="100dp"
44         android:layout_height="100dp"
45         android:background="#E91E63"
46         android:layout_below="@id/V_2"
47         android:layout_toLeftOf="@id/V_1"/>
48 
49     <View
50         android:id="@+id/V_6"
51         android:layout_width="100dp"
52         android:layout_height="100dp"
53         android:background="#FF5722"
54         android:layout_below="@id/V_4"
55         android:layout_toRightOf="@id/V_1"/>
56 
57     <View
58         android:id="@+id/V_7"
59         android:layout_width="100dp"
60         android:layout_height="100dp"
61         android:background="#673AB7"
62         android:layout_below="@id/V_5"
63         android:layout_toLeftOf="@id/V_1"/>
64 
65     <View
66         android:id="@+id/V_8"
67         android:layout_width="100dp"
68         android:layout_height="100dp"
69         android:background="#00BCD4"
70         android:layout_below="@id/V_1"
71         android:layout_toRightOf="@id/V_7"/>
72 
73     <View
74         android:id="@+id/V_9"
75         android:layout_width="100dp"
76         android:layout_height="100dp"
77         android:background="#4CAF50"
78         android:layout_below="@id/V_1"
79         android:layout_toRightOf="@id/V_8"/>
80 
81 </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="#4CAF50"/>
14     
15     <LinearLayout
16         android:layout_width="match_parent"
17         android:layout_height="0dp"
18         android:layout_weight="4"
19         android:background="#FF9800"
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="#2196F3"/>
27 
28         <View
29             android:layout_width="0dp"
30             android:layout_height="match_parent"
31             android:layout_weight="4"
32             android:background="#FF5722"/>
33 
34         <View
35             android:layout_width="0dp"
36             android:layout_height="match_parent"
37             android:layout_weight="1"
38             android:background="#2196F3"/>
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="#4CAF50"/>
47 
48 </LinearLayout>

作业3:制作登录界面(要求至少2个edittext,1个button,最好有一个imageview要求美观)

 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     android:orientation="vertical"
 8     android:background="#FFFFFF">
 9 
10     <ImageView
11         android:id="@+id/Tu_1"
12         android:layout_width="80dp"
13         android:layout_height="80dp"
14         android:background="@drawable/tx"
15         android:layout_centerHorizontal="true"
16         android:layout_marginTop="40dp"/>
17 
18     <ImageView
19         android:layout_width="50dp"
20         android:layout_height="50dp"
21         android:background="@drawable/tb"
22         android:layout_marginTop="180dp"
23         android:layout_marginLeft="70dp"/>
24 
25     <ImageView
26         android:layout_width="20dp"
27         android:layout_height="15dp"
28         android:background="@drawable/xx"
29         android:layout_marginTop="200dp"
30         android:layout_marginLeft="315dp"/>
31 
32     <TextView
33         android:layout_width="300dp"
34         android:layout_height="70dp"
35         android:layout_centerHorizontal="true"
36         android:layout_marginTop="170dp"
37         android:background="@drawable/edi_1"
38         android:text="123456789"
39         android:gravity="center"
40         android:textSize="25sp"
41         android:textColor="#000000" />
42 
43     <EditText
44         android:layout_width="300dp"
45         android:layout_height="70dp"
46         android:layout_centerHorizontal="true"
47         android:layout_marginTop="250dp"
48         android:background="@drawable/edi_1"
49         android:text="输入密码"
50         android:gravity="center"
51         android:textSize="20sp"
52         android:textColor="#B8B8B8"
53         android:textStyle="bold"/>
54 
55     <ImageButton
56         android:layout_width="80dp"
57         android:layout_height="80dp"
58         android:background="@drawable/dl"
59         android:layout_centerHorizontal="true"
60         android:layout_marginTop="360dp"/>
61 
62     <TextView
63         android:layout_width="match_parent"
64         android:layout_height="match_parent"
65         android:text="手机号登录        |       找回密码        |        新用户注册"
66         android:gravity="center_horizontal"
67         android:layout_marginTop="550dp"/>
68 </RelativeLayout>

posted @ 2021-08-26 14:30  Lwk36  阅读(66)  评论(0编辑  收藏  举报