从 RadioButton,android 中删除波纹效果?

新手上路,请多包涵

我自定义了一个 RadioButton 样式,用于在右侧添加单选按钮图像

<RadioButton
                android:layout_margin="20dp"
                android:drawableRight="@drawable/custom_btn_radio"
                android:button="@null"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Invite Only"/>

custom_btn_radio.xml

 <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/check_box" android:state_checked="false"/>
    <item android:drawable="@drawable/close_btn" android:state_checked="true"/>
</selector>

但是,单选按钮的连锁反应也扩大了。我怎样才能消除 RadioButton 的涟漪效应?以及如何自定义涟漪效应?

先感谢您。

原文由 Riyas PK 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 787
2 个回答

使 RadioButton 背景透明

android:background="#00ffffff"

要么

android:background="@android:color/transparent"

原文由 Riyas PK 发布,翻译遵循 CC BY-SA 4.0 许可协议

colorControlHighlightcolorControlActivated 设置为透明色为我解决了这个问题:

 <style name="transparent_theme">
    <item name="colorControlHighlight">@android:color/transparent</item>
    <item name="colorControlActivated">@android:color/transparent</item>
</style>

原文由 Goran Horia Mihail 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题