EditText appearance

by Mr.No » Tue, 10 Mar 2009 17:06:52 GMT


Sponsored Links
 Hello,
how do i change the size, style, typeface of a hint?
If the EditText gains the focus the border-color changes to orange,
how do i set a other color?

rgds
       Mr.No
--~--~---------~--~----~------------~-------~--~----~



EditText appearance

by Mr.No » Tue, 10 Mar 2009 18:31:04 GMT


 Hello,
how do i change the size, style, typeface of a hint?
If the EditText gains the focus the border-color changes to orange,
how do i set a other color?

rgds
       Mr.No
--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


EditText appearance

by Tseng » Wed, 11 Mar 2009 19:42:09 GMT


 You could create a colorstate list (xml file in res/drawable), for
example
 http://developer.android.com/reference/android/content/res/ColorStateList.html 

Here is an example i used for textcolors. Should work for HintColors
too!

res/drawabale/myedittextcolors.xml:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android=" http://schemas.android.com/apk/res/android" ;>
    <item
        android:state_focused="true"
        android:state_pressed="false"
                android:color="@android:color/secondary_text_dark" />
    <item
        android:state_focused="true"
        android:state_pressed="true"
                android:color="@android:color/secondary_text_dark" />
    <item
        android:state_focused="false"
        android:state_pressed="true"
                android:color="@android:color/secondary_text_dark" />
    <item
        android:color="@android:color/secondary_text_dark" />
</selector>

Now you only have to assign it to your EditText widget.

Edit the XML and change

android:textColorHint="#FFFFFF"

to

android:textColorHint="@drawable/myedittextcolors"

and it should work. This is usefull if you want to have different
colors depending on the state of the edittext (i.e. if its focused,
clicked, etc).

For one color,
use android:textColorHint="#FFFFFF" or android:textColorHint="@color/
mycustomcolor" if you have defined your color in /res/values/
colors.xml









--~--~---------~--~----~------------~-------~--~----~



EditText appearance

by Mr.No » Thu, 12 Mar 2009 17:36:28 GMT


 thx a lot :)



--~--~---------~--~----~------------~-------~--~----~



EditText appearance

by Mr.No » Thu, 12 Mar 2009 18:06:37 GMT


 Can i assigne a colorstate list to the background?
And how do i change the bordercolor when the edittext gains the focus,
without placing a backgroundimage?

Tseng schrieb:

--~--~---------~--~----~------------~-------~--~----~