Android第一次作业

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

 

 作业2:九宫格

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <RelativeLayout
 3     xmlns:android="http://schemas.android.com/apk/res/android"
 4     android:id="@+id/r1_1"
 5     android:layout_width="match_parent"
 6     android:layout_height="match_parent"
 7     android:layout_margin="2dp"
 8     android:background="#00EEEE"
 9     android:orientation="horizontal">
10 
11     <View
12         android:id="@+id/v_1"
13         android:layout_width="100dp"
14         android:layout_height="100dp"
15         android:layout_centerInParent="true"
16         android:background="#000000" />
17 
18     <View
19         android:id="@+id/v_2"
20         android:layout_width="100dp"
21         android:layout_height="100dp"
22         android:layout_centerInParent="true"
23         android:layout_toLeftOf="@+id/v_1"
24         android:background="#FF0000" />
25 
26     <View
27         android:id="@+id/v_3"
28         android:layout_width="100dp"
29         android:layout_height="100dp"
30         android:layout_centerInParent="true"
31         android:layout_toRightOf="@+id/v_1"
32         android:background="#B43104" />
33 
34     <View
35         android:id="@+id/v_4"
36         android:layout_width="100dp"
37         android:layout_height="100dp"
38         android:layout_centerInParent="true"
39         android:layout_above="@+id/v_1"
40         android:background="#B18904" />
41 
42     <View
43         android:id="@+id/v_5"
44         android:layout_width="100dp"
45         android:layout_height="100dp"
46         android:layout_centerInParent="true"
47         android:layout_below="@+id/v_1"
48         android:background="#86B404" />
49 
50     <View
51         android:id="@+id/v_6"
52         android:layout_width="100dp"
53         android:layout_height="100dp"
54         android:layout_below="@+id/v_1"
55         android:layout_toLeftOf="@id/v_5"
56         android:background="#04B45F" />
57 
58     <View
59         android:id="@+id/v_7"
60         android:layout_width="100dp"
61         android:layout_height="100dp"
62         android:layout_below="@+id/v_1"
63         android:layout_toRightOf="@id/v_5"
64         android:background="#045FB4" />
65 
66     <View
67         android:id="@+id/v_8"
68         android:layout_width="100dp"
69         android:layout_height="100dp"
70         android:layout_above="@+id/v_1"
71         android:layout_toRightOf="@id/v_4"
72         android:background="#9A2EFE" />
73 
74     <View
75         android:id="@+id/v_9"
76         android:layout_width="100dp"
77         android:layout_height="100dp"
78         android:layout_above="@+id/v_1"
79         android:layout_toLeftOf="@id/v_4"
80         android:background="#01DF01" />
81 
82 </RelativeLayout>

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

<?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:layout_margin="5dp"
    android:background="#ACFA58"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="2"
        android:background="#31B404" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="6"
        android:background="#FF00BF"
        android:orientation="horizontal">

        <View

            android:layout_width="0dp"
            android:layout_weight="2"
            android:layout_height="match_parent"
            android:background="#0000FF" />

        <View

            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="4"
            android:background="#2EFE2E" />

        <View
            
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="2"
            android:background="#0000FF" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="2"
        android:background="#FFFF00" />


</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"
    tools:context=".MainActivity"
    android:orientation="vertical"
    android:background="#2E64FE">

    <ImageView
        android:id="@+id/iv_1"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="200dp"
        android:src="@drawable/ic_launcher_round"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/iv_1"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:layout_marginBottom="10dp"
        android:orientation="vertical">

        <EditText
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:hint="用户名"
            android:textSize="25sp"
            android:textColor="#071907"
            android:layout_margin="10dp"
            android:background="@drawable/bt_1"
            android:padding="10dp"
            android:drawablePadding="10dp"
            android:drawableLeft="@drawable/user"/>

        <EditText
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:hint="密码"
            android:textSize="25sp"
            android:textColor="#071907"
            android:layout_margin="10dp"
            android:background="@drawable/bt_1"
            android:padding="10dp"
            android:drawablePadding="10dp"
            android:drawableLeft="@drawable/pwd"/>

    <Button
    android:id="@+id/btn_1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="登录"
    android:background="#FFEE00"
    android:textColor="#00FFEE"
    android:layout_margin="10dp"
    />
    </LinearLayout>
</RelativeLayout>

posted @ 2021-08-26 08:00  MXT16  阅读(42)  评论(0编辑  收藏  举报