我尝试使用AppCompactRadioButton为安卓做一个RTL收音机按钮 -将收音机放在右侧-,并且我通过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" />
我的问题是如何更改涟漪效果的中心位置,因为我将按钮设置为null,导致涟漪效果中心位置在单选按钮的中心,如上图所示,并且用户不希望在那里看到涟漪。我尝试将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>
长话短说,有没有想法改变 Android Appcompat 单选按钮的涟漪效果中心位置?