#java#案例#簡單登錄框的製作

製作簡單登錄框

1.初始化項目,
2.編輯xml文件(這裏我選擇相對佈局,layout_below 實現組件間的定位)
3. 開啓模擬器

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="10dp"
        android:paddingTop="20dp"
        tools:context=".MainActivity"
        android:background="#F4F7FA">


    <EditText
            android:id="@+id/et_username"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"

            android:layout_marginTop="100dp"


            android:hint="請輸入用戶名字"

            />
    <EditText
            android:id="@+id/et_password"
            android:layout_below="@id/et_username"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"

            android:inputType="textPassword"
            android:hint="請輸入密碼"

            />
    <CheckBox
            android:id="@+id/ch_box"
            android:layout_below="@id/et_password"
            android:layout_height="wrap_content"
            android:text="勾選保存信息"
            android:layout_width="match_parent"/>
    <Button android:layout_height="wrap_content"
            android:layout_below="@id/et_password"
            android:text="登錄"
            android:layout_width="match_parent"/>


</RelativeLayout>

\Nox\bin 敲
nox_adb.exe connect 127.0.0.1:62001

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章