zoukankan      html  css  js  c++  java
  • EditText 密码属性

            <EditText
                    android:id="@+id/et_password"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@null"
                    android:hint="密码"
                    android:inputType="textPassword"
                    android:padding="5dp"
                    android:textSize="14sp" />
    
                <CheckBox
                    android:id="@+id/cb_password_vis"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_centerVertical="true"
                    android:button="@drawable/password_selector" />
        
    View Code
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:drawable="@mipmap/icon_visible_passwords_ng" android:state_checked="true" />
        <item android:drawable="@mipmap/icon_invisible_ng" android:state_checked="false" />
    </selector>
    password_selector.xml
     cbPasswordVis.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    if(isChecked){
                        etPassword.setInputType(InputType.TYPE_CLASS_TEXT);
                    }else{
                        etPassword.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_PASSWORD);
                    }
                }
            });
    View Code
  • 相关阅读:
    Servlet接口实现类开发步骤
    Servlet概述
    Web服务器之HTTP协议与Tomcat服务器
    vant中van-picker选项插入图片
    排序算法-插入排序
    排序算法-快速排序
    排序算法-冒泡排序
    浅谈C#中Dictionary的实现。
    设计模式(23)-备忘录模式
    设计模式(22)-访问者模式
  • 原文地址:https://www.cnblogs.com/Claire6649/p/6111209.html
Copyright © 2011-2022 走看看