第一周

 

 

 

作业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="#99000000"
             android:layout_centerInParent="true"/>

    <View
             android:id="@+id/V_2"
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:background="#4CA3AF"
             android:layout_above="@+id/V_1"
             android:layout_toLeftOf="@+id/V_1"/>

    <View
             android:id="@+id/V_3"
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:background="#FF3B90"
             android:layout_above="@id/V_1"
             android:layout_toRightOf="@id/V_2"/>

    <View
             android:id="@+id/V_4"
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:background="#2196F3"
             android:layout_above="@id/V_1"
             android:layout_toRightOf="@id/V_3"/>

    <View
             android:id="@+id/V_5"
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:background="#FF5722"
             android:layout_below="@id/V_2"
             android:layout_toLeftOf="@id/V_1"/>

    <View
             android:id="@+id/V_6"
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:background="#FFE222"
             android:layout_below="@id/V_4"
             android:layout_toRightOf="@id/V_1"/>

    <View
            android:id="@+id/V_7"
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:background="#673AB7"
             android:layout_below="@id/V_5"
             android:layout_toLeftOf="@id/V_1"/>

    <View
             android:id="@+id/V_8"
             android:layout_width="100dp"
             android:layout_height="100dp"
             android:background="#2196F3"
             android:layout_below="@id/V_1"
             android:layout_toRightOf="@id/V_7"/>

    <View
             android:id="@+id/V_9"
             android:layout_width="100dp"
             android:background="#8BC34A"
             android:layout_height="100dp"
             android:layout_below="@id/V_1"
             android:layout_toRightOf="@id/V_8"/>

 

 

 

 作业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:background="#FFFFFF"
android:layout_margin="10dp"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#4CAF50"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:background="#0000FF0D"
android:orientation="horizontal">

<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#2196F3"/>

<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:background="#02FF5722"/>

<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#2196F3"/>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#4CAF50"/>

</LinearLayout>

 

 

 

4.登录页面

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

<ImageView
android:id="@+id/image_1"
android:layout_width="150dp"
android:layout_height="150dp"
android:background="@drawable/yy"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dp"/>
<EditText
android:id="@+id/zhanghao"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="20dp"
android:paddingLeft="20dp"
android:hint="请输入账号"
android:background="@drawable/log"
android:layout_below="@id/image_1"
android:layout_marginTop="40dp"/>
<EditText
android:id="@+id/mima"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="20dp"
android:paddingLeft="20dp"
android:hint="请输入密码"
android:background="@drawable/log"
android:layout_below="@id/zhanghao"
android:layout_marginTop="40dp"/>
<Button
android:layout_width="150dp"
android:layout_height="60dp"
android:layout_below="@id/mima"
android:layout_centerHorizontal="true"
android:text="登录"
android:textColor="#ffffff"
android:textSize="25sp"/>
</RelativeLayout>

 

posted @ 2021-08-29 15:57  刘姝彤  阅读(50)  评论(0编辑  收藏  举报