2

I have used this code to set textType = password.

mInputText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);

I however it ruins my custom font for the editText.

How can I combine them both?

Elad Benda2
  • 13,852
  • 29
  • 82
  • 157
  • Go to this for better achievement [http://stackoverflow.com/questions/3406534/password-hint-font-in-android?rq=1](http://stackoverflow.com/questions/3406534/password-hint-font-in-android?rq=1) – M D Jan 15 '14 at 10:27

2 Answers2

2

just set the type after setting the flags

public void setPasswordTextType() {
    mInputText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    mInputText.setTypeface(MY_TYPE);
}
Daniel Kutik
  • 6,997
  • 2
  • 27
  • 34
Elad Benda2
  • 13,852
  • 29
  • 82
  • 157
1

use android:inputType="textPassword" Ex:

<EditText
        android:id="@+id/et_password"
        android:layout_width="170dp"
        android:layout_height="wrap_content"

        android:inputType="textPassword"
        android:password="true"
        android:textSize="18sp" >

    </EditText>
android learner
  • 1,804
  • 3
  • 15
  • 13