Android中实现EditText密码显示隐藏的方法

Android中实现EditText密码显示隐藏的方法,第1张

概述在Google发布了support:design:23+以后我们发现有这么一个东西TextInputLayout,先看下效果图:

在Google发布了support:design:23+以后我们发现有这么一个东西TextinputLayout,先看下效果图:

<androID.support.design.Widget.TextinputLayout  androID:ID="@+ID/pwdLayout"  androID:layout_wIDth="match_parent"  androID:layout_height="wrap_content"  app:passwordToggleEnabled="true"  >  <EditText  androID:ID="@+ID/pwdEdt"  androID:layout_wIDth="match_parent"  androID:layout_height="wrap_content"  androID:hint="@string/edt_pwd_hint"  androID:maxlines="1"  androID:inputType="textPassword" /> </androID.support.design.Widget.TextinputLayout>

只要在布局中添加属性app:passwordToggleEnabled=”true”就可以实现当EditText的inputType=”textPassword”的时候在输入框的最右边就会显示眼睛一样的开关来显示和隐藏密码,需要的同学不妨试试看。

参考:

http://stackoverflow.com/questions/39019675/remove-show-password-icon-in-android-n

相关阅读:

Android EditText被软键盘遮盖的处理方法

Android中EditText显示明文与密码的两种方式

以上所述是小编给大家介绍的AndroID中实现EditText密码显示隐藏的方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对编程小技巧网站的支持!

总结

以上是内存溢出为你收集整理的Android中实现EditText密码显示隐藏的方法全部内容,希望文章能够帮你解决Android中实现EditText密码显示隐藏的方法所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1147272.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-31
下一篇2022-05-31

发表评论

登录后才能评论

评论列表(0条)

    保存