How to change the foreground color of a button when it focus

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

How to change the foreground color of a button when it focus

Postby silverburgh.meryl » Thu Mar 19, 2009 6:48 pm

Hi,

How can I change the foreground color of a button when it has focus?
In android, the foreground of each Tab change color when it has focus. (black when it has focus, grey when it does not)

how can I achieve that for button?

Thank you.
silverburgh.meryl
Junior Developer
Junior Developer
 
Posts: 23
Joined: Sun Feb 08, 2009 11:17 pm

Top

Postby asolanki » Mon Mar 23, 2009 6:33 am

hi

you can do this by

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/btn_pressed" />
<item android:state_focused="true"
android:drawable="@drawable/btn_selected" />
<item
android:drawable="@drawable/btn_activated" />
</selector>
asolanki
Senior Developer
Senior Developer
 
Posts: 151
Joined: Thu Jan 08, 2009 7:32 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 9 guests