刚刚注意到 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 密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
在android中剪切、复制、粘贴Cut, copy, paste in android(在android中剪切、复制、粘贴)
android EditText 融入背景android EditText blends into background(android EditText 融入背景)
更改 EditText 的线条颜色 - AndroidChange Line Color of EditText - Android(更改 EditText 的线条颜色 - Android)
EditText 始终显示带 2 位小数的数字EditText showing numbers with 2 decimals at all times(EditText 始终显示带 2 位小数的数字)
更改光标在展开的 EditText 中的开始位置Changing where cursor starts in an expanded EditText(更改光标在展开的 EditText 中的开始位置)
android中的EditText,adjustPan,ScrollView问题EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView问题)