-1

When an EditText is in password mode, it seems that the hint is shown in a different font (courrier?). I dont want this I want the font to look the same how do I avoid this.?

My current xml

<EditText 
android:hint="@string/edt_password_hint"
android:layout_width="fill_parent"
android:layout_height="wrap_content" 
android:password="true"
android:singleLine="true" />`
Sambulo Senda
  • 1,388
  • 1
  • 14
  • 19
  • This post is literally identical to: http://stackoverflow.com/questions/3406534/password-hint-font-in-android – bstar55 Jun 06 '14 at 15:10

2 Answers2

3

Possible duplicate of: Password hint font in Android

Changing the typeface in xml didn't work on the hint text for me either. I found two different solutions, the second of which has better behavior for me:

1) Remove android:password="true" from your xml file and instead, in set it in java:

EditText password = (EditText) findViewById(R.id.password_text);
password.setTransformationMethod(new PasswordTransformationMethod());

With this approach, the hint font looks good but as you're typing in that edit field, you don't see each character in plain text before it turns into a password dot. Also when making input in fullscreen, the dots will not appear, but the passoword in clear text.

2) Leave android:password="true" in your xml. In Java, ALSO set the typeface and passwordMethod:

EditText password = (EditText) findViewById(R.id.register_password_text);
password.setTypeface(Typeface.DEFAULT);
password.setTransformationMethod(new PasswordTransformationMethod());

This approach gave me the hint font I wanted AND gives me the behavior I want with the password dots.

Hope that helps!

Community
  • 1
  • 1
bstar55
  • 3,542
  • 3
  • 20
  • 24
-1
<EditText 
android:hint="@string/edt_password_hint"
android:layout_width="fill_parent"
android:layout_height="wrap_content" 
android:password="true"
android:singleLine="true" 
android:fontFamily="Arial"
/>

Add the last line to your edittext. and you can use any font you like.

Vivek Todi
  • 361
  • 1
  • 9
  • 24