Sudhanshu
Sudhanshu

Reputation: 755

text style in EditText Android

I have a login page with 2 EditText and a login Button.

The code is like this:-

<EditText
    android:id="@+id/EditText_username"
    ...
    android:hint="@string/username"
    android:inputType="text"
    ...
    android:maxLength="9"
    android:maxLines="1" >

    <requestFocus />
</EditText>

<EditText
    android:id="@+id/EditText_password"
    ...
    android:hint="@string/password"
    android:inputType="textPassword" />

<Button
    android:id="@+id/Button_login"
    ...
    android:text="@string/login" />

I have an android hint on Username EditText and on Password EditText. My problem is when the page shows on the emulator, the hints on username and password come in different styles, which is extremely irritating. Here's a screenshot of the problem -

http://i49.tinypic.com/261lzli.png

Notice Username is in system font and Password in monochrome. How do I make both of them same?! Either monochrome / system font, both are fine.

Thanks in advance!

Upvotes: 3

Views: 1629

Answers (1)

MarkMan
MarkMan

Reputation: 184

Try the following in your onCreate() method:

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

Upvotes: 4

Related Questions