Reputation: 2370
I wan't to customized my switch in android. The problem is that the default button overlay my own drawable.
What have i done:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/switch_female" android:state_checked="false"/> <item android:drawable="@drawable/switch_male" android:state_checked="true"/> </selector>
<Switch android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" android:textOff="" android:textOn="" android:id="@+id/genderSwitchOne" android:layout_below="@+id/txtViewPersonGender" android:layout_centerVertical="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_marginTop="25dp" android:background="@drawable/gender_switch"/>
but what i get is this:
it's possible to remove the default button (over the "em" from female)?
Thanks in advance.
PS: sorry but i can not paste the android xml without blockquote it.
Upvotes: 0
Views: 3418
Reputation: 38223
Set android:thumb="@null"
on the Switch
XML element. This will erase the thumb drawable from display.
EDIT: As the above produced an NPE, android:thumb="@android:color/transparent"
should do the trick as this will get loaded as an actual ColorDrawable
.
Upvotes: 1