更改android Appcompat单选按钮的android Ripple效果中心位置

Ali*_*ahi 7 android radio-button android-appcompat

我尝试使用AppCompactRadioButton在右侧按钮上制作RTL电台-Put收音机 - 我实现了这个android:drawableRight并设置android:button="@null"所以我的最终视图是我想要的,最终代码是这样的:

<android.support.v7.widget.AppCompatRadioButton
            android:id="@+id/radio_man"
            style="@style/app_font"
            android:layout_width="0dp"
            android:layout_height="@dimen/edit_text_height"
            android:layout_weight="1"
            android:button="@null"
            android:drawableRight="@drawable/form_radiobutton"
            android:minHeight="33dp"
            android:onClick="onSexRadioButtonClicked"
            android:text="@string/hint_man" />
Run Code Online (Sandbox Code Playgroud)

单选按钮上出现错误的波纹

但我的问题是如何改变涟漪效应中心位置,因为我将按钮设置为null,涟漪效果中心poisiton位于单选按钮的中心,如上图所示,并且用户不希望看到波纹.我试图将layout_direction设置为RTL,但没有修复.

我不得不提一下,我也尝试用下面的波纹绘制来解决这个问题,但没有任何改变,问题仍然存在.

<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@android:color/transparent">
<item>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item
            android:drawable="@drawable/btn_radio_activated"
            android:state_checked="true" />
        <item android:drawable="@drawable/btn_radio_deactive" />
    </selector>
</item>
</ripple>
Run Code Online (Sandbox Code Playgroud)

长话短说,有没有想法改变android Appcompat单选按钮的android Ripple效果中心位置?

Ogu*_*can 5

我可以通过将 RadioButton 的背景更改为透明来成功消除波纹效果,如下所示:

  android:background="@android:color/transparent"
Run Code Online (Sandbox Code Playgroud)

我还没有尝试过,但我想你可以设置一个带有左填充的可绘制对象来克服这个问题。