6

I need a number keyboard on a PIN EditText. I tried using

android:inputType="number|textPassword"

This brings up the number keypad, but the characters are not password chars.

How to get a number keypad that shows password chars in EditText view?

The app runs on 2.2 and above.

mmBs
  • 8,421
  • 6
  • 38
  • 46
Ron
  • 24,175
  • 8
  • 56
  • 97
  • Possible duplicate of http://stackoverflow.com/questions/2017674/edittext-set-for-password-with-phone-number-input-android/2017791#2017791 – Nathan Villaescusa Oct 15 '12 at 17:30
  • @NathanVillaescusa The accepted answer there did not help. That is not my requirement.. I used another answer that suggested setting the type programatically.. – Ron Oct 26 '12 at 12:17

4 Answers4

3

You should have a look here: Edittext set for password with phone number input? (android)

It states that android:password is deprecated, but is the only way because android:inputType="phone|textPassword" is ignored ...

<EditText
    android:id="@+id/EditText01"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:password="true"
    android:inputType="phone" 
/>
Community
  • 1
  • 1
Heskja
  • 787
  • 6
  • 19
2

In my styles.xml, these two seem to work for me:

<item name="android:inputType">numberPassword</item>
<item name="android:password">true</item>
Jeff
  • 4,136
  • 23
  • 32
0

This works:

     <EditText
         android:id="@+id/pinEdit"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_margin="4dp"
         android:digits="1234567890"
         android:inputType="textPassword"
         android:maxLength="4" >

         <requestFocus />
     </EditText>

If digits will work for you.

EDIT: Ah, I see, it doesn't bring up the number keypad....back to the drawing board.

mary
  • 174
  • 10
0

Use : "numberSigned|numberPassword"

Nguyen
  • 81
  • 7