Android第1-2周作业

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

 

 

 

 2.九宫格

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<View
android:id="@+id/view_1"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#000000"/>

<View
android:id="@+id/view_2"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#F44336"
android:layout_below="@+id/view_1"/>

<View
android:id="@+id/view_3"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#E91E63"
android:layout_below="@+id/view_2" />

<View
android:id="@+id/view_4"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#9C27B0"
android:layout_toRightOf="@+id/view_1"/>

<View
android:id="@+id/view_5"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#673AB7"
android:layout_toRightOf="@+id/view_4"/>

<View
android:id="@+id/view_6"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#3F51B5"
android:layout_below="@+id/view_1"
android:layout_toRightOf="@id/view_2"/>

<View
android:id="@+id/view_7"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#2196F3"
android:layout_toRightOf="@+id/view_6"
android:layout_below="@id/view_1"/>

<View
android:id="@+id/view_8"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#FFEB3B"
android:layout_toRightOf="@+id/view_1"
android:layout_below="@id/view_2"/>

<View
android:id="@+id/view_9"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="#FF5722"
android:layout_toRightOf="@+id/view_8"
android:layout_below="@id/view_2"/>


</RelativeLayout>

作业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">

    <TextView
        android:id="@+id/tv_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:text="用户"
        android:textSize="24sp"
        android:layout_margin="10dp"
        android:padding="10dp"/>
    <TextView
        android:id="@+id/tv_2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:text="密码"
        android:textSize="24sp"
        android:layout_margin="10dp"
        android:padding="10dp"
        android:layout_below="@id/tv_1"/>

    <EditText
        android:id="@+id/et_1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:hint="请输入用户名"
        android:textColor="#000000"
        android:textSize="24sp"
        android:layout_margin="10dp"
        android:padding="10dp"

        android:layout_toRightOf="@id/tv_1"

        android:drawablePadding="10dp"/>
    <EditText
        android:id="@+id/et_2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/tv_1"
        android:layout_centerVertical="true"
        android:hint="请输入密码"
        android:textColor="#000000"
        android:textSize="24sp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:padding="10dp"

        android:layout_toRightOf="@id/tv_2"

        android:drawablePadding="10dp"
        android:inputType="textPassword"/>
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/et_2"
        android:layout_centerHorizontal="true"
        android:layout_margin="60dp"
        android:padding="10dp"
        android:text="登录"
        android:textSize="24sp"
        android:background="#A9D870"/>
    <ImageView
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_above="@id/et_1"
        android:layout_centerInParent="true"
        android:layout_marginBottom="60dp"




</RelativeLayout>

posted @ 2021-09-01 09:22  玛卡-巴卡  阅读(44)  评论(0)    收藏  举报