0

I've to style Switch in android and found a good resource here at SO, I've

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="false" android:drawable="@drawable/switch_off_2" />
    <item android:state_focused="true"  android:drawable="@drawable/switch_off_2" />
    <item android:state_checked="true"  android:drawable="@drawable/switch_on_2" />
</selector>

and finally the Switch widget as

<Switch
    android:background="@drawable/btn_bg"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/switch1"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true" />

but result is

enter image description here

I want to know how can I hide the purple colored switch from this.

Community
  • 1
  • 1
Arshad Ali
  • 3,082
  • 12
  • 56
  • 99

1 Answers1

0

What I assume is

 android:background="@drawable/btn_bg"

will be

 android:thumb="@drawable/btn_bg"

Hope it will solve your problem.

Soham
  • 4,397
  • 11
  • 43
  • 71