Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove the effect when switch button changes state in android

How can I remove the grey circle (as in the below image) appearing when a switch button changes the state in Android 5.1.1?
Effect when Android's switch changes state

like image 631
Chu Xuan Khoi Avatar asked Jan 06 '16 06:01

Chu Xuan Khoi


1 Answers

You need to set background of Switch to disable ripple effect. In my case i set background null to achieve this.

 <Switch
    android:id="@+id/mySwitch"
    android:layout_below="@+id/tvStateDefault"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textOn="ON"
    android:thumb="@drawable/customswitchselector"
    android:track="@drawable/custom_track"
    android:showText="true"
    android:textOff="OFF"
    android:background="@null"
    android:layout_centerHorizontal="true"/>
like image 182
Gaurav Gupta Avatar answered Oct 17 '22 00:10

Gaurav Gupta