[置顶] 显示/隐藏登录密码
生活随笔
收集整理的這篇文章主要介紹了
[置顶] 显示/隐藏登录密码
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
利用復選框勾選---顯示/隱藏登錄密碼(例如 電腦無線密碼查看)
【MainActivity.java】
package com.example.test;import android.os.Bundle; import android.app.Activity; import android.text.InputType; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.EditText;public class MainActivity extends Activity {private CheckBox c1;private EditText e1;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);c1 = (CheckBox) findViewById(R.id.checkBox1);e1 = (EditText) findViewById(R.id.editText1);e1.getText().toString();c1.setOnCheckedChangeListener(new OnCheckedChangeListener() {@Overridepublic void onCheckedChanged(CompoundButton buttonView,boolean isChecked) {// TODO Auto-generated method stubif (isChecked) {e1.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);} else {e1.setInputType(InputType.TYPE_CLASS_TEXT| InputType.TYPE_TEXT_VARIATION_PASSWORD);}}});} }轉載于:https://www.cnblogs.com/anjon520/p/3249911.html
總結
以上是生活随笔為你收集整理的[置顶] 显示/隐藏登录密码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: WebGIS在行业中应用的演变
- 下一篇: 提高生产力:文件和IO操作(Apache