Android EditText for password with android:hint(带有 android:hint 的 Android EditText 密码)
问题描述
刚刚注意到 android:password 已被弃用,我们应该使用 android:inputType.通过在我的 xml 中设置来试验它
Just noticed that android:password has been deprecated, and we should be using android:inputType. Was experimenting with it by setting in my xml
android:inputType="textPassword"
确实是这样的
android:password="true"
对于 EditText,但似乎如果我使用 android:inputType,android:hint 将不起作用.EditText 将为空白.使用 android:password 和 android:hint 时没有这样的问题.我在这里遗漏了一些关于 android:inputType 的内容吗?
for EditText, but it seems that if I use android:inputType, android:hint will not work. The EditText will be blank. There is no such issues when using android:password with android:hint. Am I missing something here about android:inputType?
推荐答案
刚刚偶然发现了答案.android:inputType="textPassword"
确实适用于 android:hint
,与 android:password
相同.唯一的区别是当我使用 android:gravity="center"
时,如果我使用的是 android:inputType
,提示将不会显示.结案!
Just stumbled on the answer. android:inputType="textPassword"
does work with android:hint
, same as android:password
. The only difference is when I use android:gravity="center"
, the hint will not show if I'm using android:inputType
. Case closed!
这篇关于带有 android:hint 的 Android EditText 密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:带有 android:hint 的 Android EditText 密码


- Android viewpager检测滑动超出范围 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01