在Google发布了support:design:23+以后我们发现有这么一个东西TextInputLayout,先看下效果图: <Android.support.d
在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文本框之外任何地方隐藏键盘的解决办法Android EditText密码的隐藏和显示功能Android编程实现点击EditText之外的控件隐藏软键盘功能Android编程之ListView和EditText发布帖子隐藏软键盘功能详解Android EditText长按菜单中分享功能的隐藏方法
--结束END--
本文标题: Android中实现EditText密码显示隐藏的方法
本文链接: https://www.lsjlt.com/news/22647.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-01-21
2023-10-28
2023-10-28
2023-10-27
2023-10-27
2023-10-27
2023-10-27
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0