第一、二周作业

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

 

 


作业2:九宫格

<?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">

    <View
        android:id="@+id/v_1"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="@color/black"
        android:layout_centerInParent="true"/>
    <View
        android:id="@+id/v_2"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="@color/teal_200"
        android:layout_centerInParent="true"
        android:layout_toLeftOf="@id/v_1"/>
    <View
        android:id="@+id/v_3"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="#FF5722"
        android:layout_centerVertical="true"
        android:layout_toRightOf="@id/v_1"/>


    <View
        android:id="@+id/v_4"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="#FFEB3B"
        android:layout_centerHorizontal="true"
        android:layout_above="@id/v_1"/>
    <View
        android:id="@+id/v_5"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="#3F51B5"
        android:layout_below="@id/v_1"
        android:layout_centerHorizontal="true"/>
    <View
        android:id="@+id/v_6"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="#00FF0A"
        android:layout_above="@id/v_1"
        android:layout_toLeftOf="@id/v_1"/>
    <View
        android:id="@+id/v_7"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="#008EFF"
        android:layout_above="@id/v_1"
        android:layout_toRightOf="@id/v_1"/>
    <View
        android:id="@+id/v_8"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="#FF9800"
        android:layout_below="@id/v_1"
        android:layout_toLeftOf="@id/v_1"/>
    <View
        android:id="@+id/v_9"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="@color/teal_200"
        android:layout_below="@id/v_1"
        android:layout_toRightOf="@id/v_1"/>

</RelativeLayout>

  

 

 


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

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:padding="20dp"
    android:layout_height="match_parent"
    tools:context=".MainActivity"
    android:orientation="vertical">
    <View
        android:id="@+id/v_1"
        android:layout_width="match_parent"
        android:layout_height="10dp"
        android:layout_weight="1"
        android:background="#E91E63"
        />
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:orientation="horizontal"
        android:background="@color/purple_700"
        android:layout_weight="2">
        <View
            android:id="@+id/v_2"
            android:layout_width="50dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@color/purple_200"/>
        <View
            android:id="@+id/v_3"
            android:layout_width="50dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@color/teal_200"/>
        <View
            android:id="@+id/v_4"
            android:layout_width="50dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#FF5722"/>
        </LinearLayout>
    <View
        android:id="@+id/v_5"
        android:layout_width="match_parent"
        android:layout_height="10dp"
        android:layout_weight="1"
        android:background="#FFEB3B"/>


</LinearLayout>

  

 

 


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

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
    tools:context=".MainActivity"
    android:padding="35dp">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <TextView
            android:layout_width="100dp"
            android:layout_height="50dp"
            android:text="QQ"
            android:textSize="30sp"/>
            <ImageView
                android:layout_width="166dp"
                android:layout_height="102dp"
                android:layout_marginTop="50dp"
                android:layout_gravity="center"
                    android:background="@drawable/qq"/>


            <EditText
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:hint="请输入用户名"
                android:background="@drawable/btn_3"
                android:inputType="textPassword"
                android:layout_marginTop="70dp"
                />
            <EditText
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:hint="请输入密码"
                android:background="@drawable/btn_3"
                android:layout_marginTop="25dp"
                android:inputType="textPassword"/>

            <Button
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:background="@drawable/btn_2"
              android:layout_marginTop="30dp"
                android:text="登录"
                android:textSize="25dp"/>
    </LinearLayout>


</LinearLayout>

  

 

posted @ 2021-08-28 21:29  樽梦  阅读(45)  评论(0编辑  收藏  举报