【问题标题】:How can I remove the effect when switch button changes state in android如何在android中切换按钮更改状态时删除效果
【发布时间】:2016-01-06 06:28:30
【问题描述】:

如何去除在 Android 5.1.1 中切换按钮更改状态时出现的灰色圆圈(如下图)?
Effect when Android's switch changes state

【问题讨论】:

  • 它被称为涟漪效应,无法移除,因为它集成在android本身中
  • 你使用SwitchSwitchCompat
  • 不幸的是,切换。你有什么解决办法吗?
  • 谢谢,维韦克。我真的很欣赏你的信息

标签: android button switch-statement


【解决方案1】:

您需要设置 Switch 的背景以禁用波纹效果。在我的情况下,我设置了 background 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"/>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-19
    相关资源
    最近更新 更多