Android view state_pressed Blue background -
i have lot of custom views , have style state_pressed. rectangle
solid android:color="#dc2d5a8c"
what trying simulate blue background color comes standard views/controls. example: when click on button or list view item, background changes blue (on_pressed).
i got work above style, problem let's call tint effect. in button, text caption black. when press, background blue , text color changes white.
now how can achieve such called "tint" change in custom control's view?
your response appreciated.
thanks!
you can use selector xml file this.you must setting background button.instead of set xml file background.create selector.xml file in drawable folder shown below , set xml file background button : android:background="@drawable/selector"
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- when selected, use blue --> <item android:drawable="@drawable/btn_blue" android:state_pressed="true" /> <!-- when not selected, use black--> <item android:drawable="@drawable/btn_black"/> </selector>
by doing called tint effect button.hope you.
Comments
Post a Comment