如何在android中切换按钮更改状态时删除效果

Chu*_*hoi 2 android button switch-statement

如何在开关按钮更改Android 5.1.1中的状态时删除出现的灰色圆圈(如下图所示)?
Android的开关改变状态时的效果

Gau*_*pta 6

您需要设置Switch的背景以禁用涟漪效应.在我的情况下,我设置背景null来实现这一点.

 <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"/>
Run Code Online (Sandbox Code Playgroud)