The code has been sorted out, and the effect is as follows:
Code
//set input to password mode Inputetp1.setinputtype (Inputtype.type_class_number | editorinfo.type_number_variation_password); inputetp1.setdrawablerightlistener (new Edittextpassword.drawablerightlistener () { @Override public void ondrawablerightclick () { //can also be used to achieve other effects, such as one-click emptying if (MISSHOW1) { Inputetp1.setcompounddrawableswithintrinsicbounds (0, 0, r.drawable.eye_grey, 0); inputetp1.setinputtype (Inputtype.type_class_number | editorinfo.type_number_ Variation_password); } else { inputetp1.setcompounddrawableswithintrinsicbounds (0, 0, r.drawable.eye_orange, 0);// inputetp.setinputtype (Inputtype.type_text_variation_visible_ PASSWORD); inputetp1.setinputtype (Inputtype.type_class_number | editorinfo.type_number_ Variation_normal); } mIsShow1 = !mIsShow1; } });
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/06/8B/wKiom1m59KeDzXOLAACbVGiWoZ4113.png "title=" Qq20170914111544.png "alt=" Wkiom1m59kedzxolaacbvgiwoz4113.png "/>
Address: Https://github.com/geeklx/MyApplication/tree/master/p039_edittextpwd
This article is from the "Liangxiao Technology Center" blog, please be sure to keep this source http://liangxiao.blog.51cto.com/3626612/1965175
Android Studio Phase 53rd-Custom EditText password keyboard