本文实例为大家分享了Android实现记住密码功能的具体代码,供大家参考,具体内容如下
LoginActivity.java
包com.wangdeqiang.www.chatwithrobot.BroadcastBestPractice; 进口android.content.Intent; 进口android.content.SharedPreferences; 进口android.os.Bundle; 进口android.preference.PreferenceManager; 进口android.view.View; 进口android.widget.Button; 进口android.widget.CheckBox; 进口android.widget.EditText; 进口android.widget.Toast; 进口com.wangdeqiang.www.chatwithrobot.R; 进口静态com.wangdeqiang.www.chatwithrobot.R.id.account;/* * * @author */公开课LoginActivity延伸BaseActivity { 私人SharedPreferences参照; 私人SharedPreferences。编辑器编辑器; 私人EditText accountEdit; 私人EditText passwordEdit; 私人按钮登录; 私人复选框rememberPass; @Override 保护空白> & lt; & # 63; xml version=" 1.0 " encoding=" utf - 8 " & # 63;比; & lt; TableLayout xmlns: android=" http://schemas.android.com/apk/res/android " android: layout_width=" match_parent " android: layout_height=" match_parent " android: stretchColumns=" 1 " 比; & lt; LinearLayout xmlns: android=" http://schemas.android.com/apk/res/android " android: layout_width=" match_parent " android: layout_height=" wrap_content " 面向android:=按怪薄北? LinearLayout & lt; android: layout_width=" match_parent " android: layout_height=" 60 dp " 面向android:="水平"比; & lt; TextView android: layout_width=" 90 dp” android: layout_height=" wrap_content " android: layout_gravity=" center_vertical " android:文本="帐户:“ android: textSize=" 18 sp "/比; EditText & lt; android: id=癅 + id/账户” android: layout_width=" 0 dp” android: layout_height=" wrap_content " android: layout_gravity=" center_vertical " android: layout_weight=" 1 "/比; & lt;/LinearLayout> LinearLayout & lt; android: layout_width=" match_parent " android: layout_height=" 60 dp " 面向android:="水平"比; & lt; TextView android: layout_width=" 90 dp” android: layout_height=" wrap_content " android: layout_gravity=" center_vertical " android:文本="密码" android: textSize=" 18 sp "/比; EditText & lt; android: id=癅 + id/密码” android: layout_width=" 0 dp” android: layout_height=" wrap_content " android: layout_gravity=" center_vertical " android: layout_weight=" 1 " android: inputType=" textPassword "/比; & lt;/LinearLayout> & lt;/LinearLayout> & lt; TableRow> & lt;复选框 android: id=癅 + id/remember_pass” android: layout_height=" wrap_content "/比; & lt; TextView android: layout_height=" wrap_content " android:文本=凹亲∶苈搿?比; & lt;/TableRow> & lt;按钮 android: id=癅 + id/登录” android: layout_height=" wrap_content " android: layout_span=" 2 " android:文本="登录"/比; & lt;/TableLayout>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。