Edittext set for password with phone number input? (android)

Viewed 16873

How do I get a Edittext with both a phone input and the ability to hide the string. I know that

android:inputType="textPassword"

hides the string, while

android:inputType="phone"

brings up a dialpad interface.

How to combine the two?

5 Answers

android:password is deprecated, but AFAIK 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" />

I haven't tried this, but it might be possible to combine the two like so:

android:inputType="textPassword|phone"

since inputType can take on multiple values.

Related