Login case

时间:2023-03-09 00:24:42
Login case

第一步:画UI,代码如下:

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" > <EditText
android:id="@+id/et_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入用户名"
/> <EditText
android:id="@+id/et_userpassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入密码"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
>
<CheckBox
android:id="@+id/cb_ischeck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="记住用户名密码"
/>
<!-- layout_alignParentRight相对于父窗口的右边 -->
<Button
android:onClick="Login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="登录"
android:layout_alignParentRight="true"
/> </RelativeLayout> </LinearLayout>