0

I am trying to create a listview with switches. It is working; but not as how i expected it to be. The text ON/OFF is written inside the circle(slider) and not behind it which looks awkward. I cannot find a way on how to put the text behind the slider and i tried searching but it seems that no one is experiencing this problem aside from me.

Also, is there a way where i can edit the custom switch or am i obliged to use android:background like what others are doing base on my research. (I am avoiding to use background because i am not good at Photoshop).

Thank you in advance!

User_1191
  • 981
  • 2
  • 8
  • 24
Chester Lim
  • 459
  • 7
  • 19

1 Answers1

0

You can have 9 patch images for switch

<Switch
            android:id="@+id/switch_bg2"
            android:layout_width="92dp"
            android:layout_height="24dp"
            android:checked="true"
            android:focusable="false"
            android:textOff="O"
            android:textOn="I"
            android:thumb="@drawable/switch_thumb"
            android:track="@drawable/switch_bg"
            android:typeface="sans" />
Anil Meenugu
  • 1,411
  • 1
  • 11
  • 16