源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

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

  • 时间:2022-07-24 01:05 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Android中实现EditText密码显示隐藏的方法
在Google发布了support:design:23+以后我们发现有这么一个东西TextInputLayout,先看下效果图: [img]http://files.jb51.net/file_images/article/201701/2017010615271612.png[/img]
<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>
只要在布局中添加属性[code]app:passwordToggleEnabled=”true”[/code]就可以实现当EditText的[code]inputType=”textPassword”[/code]的时候在输入框的最右边就会显示眼睛一样的开关来显示和隐藏密码,需要的同学不妨试试看。 参考: [url=http://stackoverflow.com/questions/39019675/remove-show-password-icon-in-android-n]http://stackoverflow.com/questions/39019675/remove-show-password-icon-in-android-n[/url] 相关阅读: [url=http://www.1sucai.cn/article/94705.htm]Android EditText被软键盘遮盖的处理方法[/url] [url=http://www.1sucai.cn/article/90004.htm]Android中EditText显示明文与密码的两种方式[/url] 以上所述是小编给大家介绍的Android中实现EditText密码显示隐藏的方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对编程素材网网站的支持!
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部