How do I specify EditText inputType as number and password?
问题 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