Cannot change android Switch style when using Holo Everywhere -
i having trouble changing style of switch view in project , can't figure out doing wrong or missing... project uses holo everywhere.
i can't change text, thumb or track. i've tried applying android:thumb , android:track drawables directly xml nothing changes. not android:textoff , android:texton have effect.
i found great post on how customise android switch view style , looked through code couldn't find doing wrong: http://custom-android-dn.blogspot.co.uk/2013/01/how-to-use-and-custom-switch-in-android.html
really not sure else try.
here xml code:
<switch android:id="@+id/home_availability_switch" style="@style/myswitch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_centervertical="true" android:enabled="true" android:focusable="true" android:textoff="free" android:texton="busy" /> here style:
<style name="myswitch" parent="@style/holo.switch.light"> <item name="android:thumb">@drawable/selector_availability_switch_thumb</item> <item name="android:track">@drawable/selector_availability_switch_background</item> </style> here thumb selector (these default system drawables. have tried different drawables):
<item android:drawable="@drawable/switch_thumb_pressed_holo_light" android:state_pressed="true"/> <item android:drawable="@drawable/switch_thumb_activated_holo_light" android:state_checked="true"/> <item android:drawable="@drawable/switch_thumb_disabled_holo_light" android:state_enabled="false"/> <item android:drawable="@drawable/switch_thumb_holo_dark"/> here track selector (these default system drawables. have tried different drawables):
<item android:drawable="@drawable/switch_bg_disabled_holo_dark" android:state_enabled="false"/> <item android:drawable="@drawable/switch_bg_focused_holo_dark" android:state_focused="true"/> <item android:drawable="@drawable/switch_bg_holo_dark"/> i found post how can style android switch? , follow instructions had no luck.
any 1 else had similar experience when using holo everywhere?
you need define switch this. need whole package name in there work.
<org.holoeverywhere.widget.switch android:id="@+id/lockswitch" style="?switchstyleold" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="testswitch" /> hope helps.
Comments
Post a Comment