安卓的EditText密码与Android:提示 [英] Android EditText for password with android:hint
问题描述
只注意到机器人:密码已去precated ,我们应该用机器人: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"
事实上,它的行为像
Indeed it behaves like
android:password="true"
有关的EditText,但似乎如果我使用的Android版本:inputType,机器人:提示将无法正常工作。该EditText上将会是空白。有使用Android的时候没有这样的问题:与Android密码:提示。我失去了一些东西在这里关于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?
推荐答案
只是偶然的答案。 安卓inputType =textPassword
做工作,安卓提示
,同机器人:密码
。唯一的区别是,当我使用安卓重力=中心
,提示也不会,如果我使用显示安卓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!
这篇关于安卓的EditText密码与Android:提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!