android how to create a switch with showing text on and off how?

31 Views Asked by At

i want to create a switch or toggle in my android application that show both text on and off, in my case i use this

 <Switch
            android:id="@+id/it_radio_group"
            style="@style/RectangularSwitchStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginStart="5dp"
            android:showText="true"
            android:switchTextAppearance="@style/SwitchTextAppearanceOn"
            android:textOff="No"
            android:textOn="Yes"

            android:checked="false"
            android:textSize="16sp"
            android:thumb="@drawable/rectangle_switch_thumb"
            android:track="@drawable/rectangle_switch" />

the switch appears like the image below enter image description here

i want to show the text Yes also, and make it not clicked by default, i didnt find anything by searching

0

There are 0 best solutions below