Text style in EditText android

I have a login page with 2 EditText

and login Button

.

The code looks 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 android prompt by name EditText

and password EditText

. My problem is when the page is displayed on the emulator the username and password hints come in different styles, which is extremely annoying. Here is a screenshot of the problem -

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

Notice Username is in system font and Password is in monochrome. How can I make them the same ?! Or monochrome / system font, both are fine.

Thanks in advance!

+3


source to share


1 answer


Try the following in method onCreate()

:



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

      

+4


source







All Articles