1.app功能:通过注册登录账户,拥有一个账户本,能够将平时自己容易的忘记的账户记录下来,并可以保持到云端,不需要担心数据丢失,只要登录账户,便可获取到自己的账户本。
2.实现的效果图,如下:
以下界面分别为注册界面、登录界面、提交账户内容界面、账户列表界面、长按删除账户信息、具体账户内容信息
3.实现的工程目录如下:
4.实现的具体过程:
a.布局代码:
(1)登录界面图:activity_main.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:tools="http://schemas.android.com/tools" 4 android:background="#ffffff" 5 android:weightSum="5" 6 android:orientation="vertical" 7 android:layout_width="match_parent" 8 android:layout_height="match_parent" 9 tools:context="base.secret.MainActivity"> 10 <LinearLayout 11 android:layout_weight="2" 12 android:layout_width="match_parent" 13 android:layout_height="0dp"/> 14 <base.secret.TextInputLayout 15 android:layout_marginRight="20dp" 16 android:layout_marginLeft="20dp" 17 android:gravity="center_vertical" 18 android:id="@+id/edit_user" 19 android:layout_width="match_parent" 20 android:layout_height="wrap_content"> 21 <EditText 22 android:textSize="20sp" 23 android:hint="@string/login_user" 24 android:gravity="center" 25 android:layout_width="match_parent" 26 android:layout_height="wrap_content" /> 27 </base.secret.TextInputLayout> 28 <base.secret.TextInputLayout 29 android:layout_marginRight="20dp" 30 android:layout_marginLeft="20dp" 31 android:layout_marginTop="20dp" 32 android:id="@+id/edit_psw" 33 android:layout_width="match_parent" 34 android:layout_height="wrap_content"> 35 <EditText 36 android:inputType="textPassword" 37 android:textSize="20sp" 38 android:hint="@string/user_psw" 39 android:gravity="center" 40 android:layout_width="match_parent" 41 android:layout_height="wrap_content" /> 42 </base.secret.TextInputLayout> 43 <LinearLayout 44 android:layout_marginTop="20dp" 45 android:gravity="center" 46 android:orientation="horizontal" 47 android:layout_width="match_parent" 48 android:layout_height="wrap_content"> 49 <Button 50 android:textSize="25sp" 51 android:text="@string/login" 52 android:id="@+id/btn_login" 53 android:layout_width="wrap_content" 54 android:layout_height="wrap_content" /> 55 <Button 56 android:layout_marginLeft="20dp" 57 android:textSize="25sp" 58 android:text="@string/register" 59 android:id="@+id/btn_register" 60 android:layout_width="wrap_content" 61 android:layout_height="wrap_content" /> 62 </LinearLayout> 63 </LinearLayout>