Android第一二周作业

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

 

 

 

 作业2:九宫格

<?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要求美观)

<?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"
    android:orientation="vertical"
    android:background="#FFFFFF">

    <ImageView
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:background="@drawable/tx"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="50dp"/>

    <TextView
        android:layout_width="300dp"
        android:layout_height="60dp"
        android:background="@drawable/text"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="170dp"
        android:text="Wck123456"
        android:textSize="26sp"
        android:textStyle="bold"
        android:gravity="center"/>

    <EditText
        android:layout_width="300dp"
        android:layout_height="60dp"
        android:background="@drawable/text"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="255dp"
        android:text="请输入密码"
        android:textSize="18sp"
        android:gravity="center"
        android:textColor="#A2A2A2"/>

    <Button
        android:layout_width="250dp"
        android:layout_height="60dp"
        android:background="@drawable/btn_1"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="360dp"
        android:text="登录"
        android:textSize="18sp"
        android:textStyle="bold"
        android:textColor="#FFFFFF"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="550dp"
        android:text="新用户注册            |           忘记密码?"/>


</RelativeLayout>

 

posted @ 2021-08-29 11:23  王城凯  阅读(31)  评论(0编辑  收藏  举报