BoD/android-switch-backport

Customize Switch

aat-antoine opened this issue · 4 comments

When we try to customize this switch using the property :
android:thumb="@drawable/switch_thumb"
android:track="@drawable/switch_bg"
(as described here http://stackoverflow.com/questions/10118050/how-can-i-style-an-android-switch)

it doesn't work whereas with the Switch from android sdk it works !

BoD commented

You must not use android:thumb and android:track, but instead, app:thumb and app:track (and you must add xmlns:app="http://schemas.android.com/apk/res-auto" to the root of your xml document).

Thx a lot

Is this the same issue for customizing textcolor ?

BoD commented

Yes. You can see what attributes can be used by looking at this file: https://github.com/BoD/android-switch-backport/blob/master/library/res/values/attrs.xml