Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 886
Kevin Westwood Avatar asked Mar 26 '12 22:03

Kevin Westwood


People also ask

What is the effect of setting the inputType attribute of a TextView to number?

The android:inputType attribute allows you to specify various behaviors for the input method. Most importantly, if your text field is intended for basic text input (such as for a text message), you should enable auto spelling correction with the "textAutoCorrect" value.

How do you edit text only in numbers?

Using phone inputType EditText has an attribute called android:inputType . Providing android:inputType with value phone can display numbered keyboard when the EditText gets focus. Create an Android Project and replace layout (activity_main.

How do I get just the number keyboard on my android?

To get the number pad, and tap the special character key in the lower left corner of the keyboard. Then, tap the key just to the left of the spacebar with the numbers 1-4 in a little square. You'll get a cool little number pad along with common mathematical operators.

How can add only numbers in EditText in android?

You can use android:inputType="number" in the XML file. You can specify other values such as numberDecimal as well. Also, you might additionally want to use android:singleLine="true" for a single line Edittext .


1 Answers

Set android:inputType="numberPassword"

See this Link

like image 148
woyaru Avatar answered Sep 20 '22 16:09

woyaru