问题
I have the following:
<EditText
android:inputType="number"
android:password="true"
....
</EditText>
I'm getting a warning that "android:password" is deprecated and that I should use inputType instead. Is there a way to specify inputType as number and password?
回答1:
Set android:inputType="numberPassword"
See this Link
回答2:
you should use TYPE_CLASS_NUMBER.
EDIT:
As this answer
android:inputType="textPassword|number"
ignore textPassword and only accept number but not password.
So you should use android:inputType="textPassword|number"
with android:password="true"
.
that seems to be the only solution.
回答3:
Just set your input type to this android:inputType="textPassword|number"
来源:https://stackoverflow.com/questions/9880516/how-do-i-specify-edittext-inputtype-as-number-and-password