5

I need to override styles for two EditText instances. I have two issues regarding this:

1) One EditText is for entering a password but with the same typeface. If I delete password=true it works. By default typeface=sans.

<style name="customEdit" parent="@android:style/Widget.EditText">
    <item name="android:password">true</item>
    <item name="android:typeface">serif</item>  //doesn work.
</style>

2) Both fields have hints. And I need to set the color of these hints; is it possible? I didn't find something like this: android:hintColor...

<item name="android:textColor">#acacac</item> //works for text only.

I tried two variants for password type:

  • android:inputType="textPassword"
  • android:password=true

Both change typeface to default automaticaly, even in the "UI Constructor".

Zsolt Safrany
  • 13,290
  • 6
  • 50
  • 62
GeX
  • 619
  • 1
  • 9
  • 19

2 Answers2

6

For your second problem, this can be helpful(under the EditText tag):

        android:textColorHint="#3b64a8"

In your Activity:

    passwordText.setTypeface(Typeface.SERIF);
    passwordText.setTransformationMethod(new PasswordTransformationMethod());

here "passwordText" is the EditText for password.

Yogesh Somani
  • 2,624
  • 3
  • 21
  • 34
3

This should work, Try it

<style name="customEdit" parent="@android:style/Widget.EditText">
        <item name="android:inputType">textPassword</item>
        <item name="android:password">true</item>
        <item name="android:typeface">serif</item> 
        <item name="android:textColorHint=">#F28EC1</item>
        <item name="android:textSize">20sp</item>
        <item name="android:textStyle">bold</item>         
    </style>
K_Anas
  • 31,226
  • 9
  • 68
  • 81