I wan't to customized my switch in android. The problem is that the default button overlay my own drawable.
What have i done:
- create my own graphics (2 graphics)
- create a xml in the drawable folder, that's look like this:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://ift.tt/nIICcg">
<item android:drawable="@drawable/switch_female" android:state_checked="false"/>
<item android:drawable="@drawable/switch_male" android:state_checked="true"/>
</selector>
- and my switch definition looks like this:
<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.
No comments:
Post a Comment