学习了SharedPerferences之后,我简单地制作了实现记住密码和账号的功能效果,总的来说收货还是比较多的,在老师的帮助下,我解决了一个又一个疑难问题,下面是我制作这个项目用到的代码,希望能够帮到你们更好地完成项目!
1. sh.xml的代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="用户名"
android:textSize="16sp"
/>
<EditText
android:id="@+id/edit_userinfo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="8"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width=