2024/03/19(2024春季)

学习时长:2小时

代码量:332行

博客数量:1篇

今天开始了老师交给我们的个人Android任务,今天完成了登录注册的主界面,基本的视图绑定,还没有开始连接数据库操作。

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

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="@string/app_name"
        android:textSize="40sp" />

    <Space
        android:layout_width="wrap_content"
        android:layout_height="30dp" />

    <LinearLayout

        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal">

        <TextView

            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:text="@string/username"
            android:textSize="20sp" />

        <EditText
            android:id="@+id/username"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="3" />
    </LinearLayout>

    <Space
        android:layout_width="wrap_content"
        android:layout_height="20dp" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal">

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:text="@string/password"
            android:textSize="20sp" />

        <EditText
            android:id="@+id/password"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="3"
            android:inputType="textPassword" />
    </LinearLayout>
    <Space
        android:layout_width="wrap_content"
        android:layout_height="10dp" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal">
        <Space
            android:layout_width="0sp"
            android:layout_height="wrap_content"
            android:layout_weight="2" />
        <CheckBox
            android:id="@+id/is_save"
            android:gravity="right"
            android:layout_width="0sp"
            android:layout_height="wrap_content"
            android:text="@string/rempwd"
            android:layout_weight="9"
            android:textSize="20sp" />

        <Space
            android:layout_width="0sp"
            android:layout_height="wrap_content"
            android:layout_weight="4"/>
        <CheckBox
            android:id="@+id/auto_login"
            android:gravity="right"
            android:layout_width="0sp"
            android:layout_height="wrap_content"
            android:text="@string/auto_login"
            android:layout_weight="9"
            android:textSize="20sp" />
        <Space
            android:layout_width="0sp"
            android:layout_height="wrap_content"
            android:layout_weight="2" />

    </LinearLayout>

    <TextView
        android:id="@+id/message"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text=""
        android:textColor="#ff0000"
        android:textSize="15sp" />

    <Space
        android:layout_width="wrap_content"
        android:layout_height="20dp" />

    <LinearLayout

        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal">

        <Button
            android:id="@+id/login"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/login"
            android:textSize="20sp" />

        <Space
            android:layout_width="40dp"
            android:layout_height="match_parent" />

        <Button
            android:id="@+id/regis"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/regis"
            android:textSize="20sp" />
    </LinearLayout>

    <Space
        android:layout_width="match_parent"
        android:layout_height="300sp" />
    <Button
        android:id="@+id/turn_to_teacher"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/turn_to_teacher">
    </Button>
</LinearLayout>
<?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">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="@string/regis"
        android:textSize="40sp" />

    <Space
        android:layout_width="wrap_content"
        android:layout_height="30dp"/>


    <LinearLayout

        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal">

        <TextView

            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:textSize="20sp"
            android:text="@string/username"
            />
        <EditText
            android:id="@+id/username"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="3"/>
    </LinearLayout>

    <Space
        android:layout_width="wrap_content"
        android:layout_height="20dp"/>


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal">
        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:textSize="20sp"
            android:text="@string/name"
            />
        <EditText
            android:id="@+id/name"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="3"/>
    </LinearLayout>

    <Space
        android:layout_width="wrap_content"
        android:layout_height="20dp"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal">
        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:textSize="20sp"
            android:text="@string/phone"
            />
        <EditText
            android:id="@+id/phone"
            android:layout_width="0dp"
            android:inputType="numberDecimal|number"
            android:layout_height="wrap_content"
            android:layout_weight="3"/>
    </LinearLayout>

    <Space
        android:layout_width="wrap_content"
        android:layout_height="20dp"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal">
        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:textSize="20sp"
            android:text="@string/user_class"
            />
        <EditText
            android:id="@+id/user_class"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="3"/>
    </LinearLayout>


    <Space
        android:layout_width="wrap_content"
        android:layout_height="20dp"/>


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:gravity="center">

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:textSize="20sp"
            android:text="@string/password"
            />
        <EditText
            android:id="@+id/password"
            android:layout_width="0dp"
            android:inputType="textPassword"
            android:layout_height="wrap_content"
            android:layout_weight="3"/>
    </LinearLayout>
    <Space
        android:layout_width="wrap_content"
        android:layout_height="20dp"/>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:gravity="center">

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:textSize="20sp"
            android:text="@string/password2"
            />
        <EditText
            android:id="@+id/password2"
            android:layout_width="0dp"
            android:inputType="textPassword"
            android:layout_height="wrap_content"
            android:layout_weight="3"/>
    </LinearLayout>

    <TextView
        android:id="@+id/message"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textColor="#ff0000"
        android:textSize="15sp"
        android:gravity="center"
        android:text="" />
    <Space
        android:layout_width="wrap_content"
        android:layout_height="20dp"/>
    <LinearLayout

        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:gravity="center">
        <Space
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"/>
        <Button
            android:id="@+id/regis"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:textSize="20sp"
            android:text="@string/regis" />
        <Space
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"/>
    </LinearLayout>

</LinearLayout>

 

posted @ 2024-03-19 22:09  伐木工熊大  阅读(3)  评论(0编辑  收藏  举报