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 模拟器中激活网络位置提供程序? 2022-01-01
- 在 iOS8 中无法获得正确的键盘高度值 2022-01-01
- 我的 UIImageView 的任务 2022-01-01
- 如何将多个组件添加到 PickerView? 2022-01-01
- 在 appComponent dagger 2 中动态添加测试模块? 2022-01-01
- Android:STATE_SELECTED不工作 2022-01-01
- 突出显示朗读文本(在 iPhone 的故事书类型应用程序中) 2022-01-01
- 新的@SystemApi 注解是什么意思,和@hide 有什么区别 2022-01-01
- 可可/目标C(OSX不是iOS)从子对象访问父对象 2022-01-01
- - (CGRect)convertRect:(CGRect)rect toView:(UIView *)view 如何工作 2022-01-01
