#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

在这里插入图片描述

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