以下是一种变通办法:
先创建一个“ 强” Shape 可绘制 < / 强”, 作为您的分隔符 。 以下是一个例子 :
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid
android:color="@color/white" />
<stroke
android:width="0.3dp"
android:color="@color/black" />
</shape>
这只是一个简单的黑边框。 把它放在您的可绘图/ 文件夹中, 并命名它为“ 坚固” 客户端_ divider. xml 坚固” 。
然后,转到您的布局上,该布局使用“强”无线电组 强”。使用“可绘制的形状”作为每个“强”无线电按钮 强”的背景。下面举一个例子:
<RadioGroup
android:id="@+id/radioGroup1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:divider="@color/black" >
<RadioButton
android:id="@+id/radio0"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_radiogroup_divider"
android:checked="true"
android:text="RadioButton" />
<RadioButton
android:id="@+id/radio1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_radiogroup_divider"
android:text="RadioButton" />
<RadioButton
android:id="@+id/radio2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_radiogroup_divider"
android:text="RadioButton" />
</RadioGroup>
您也可以在您的 RadioGroup 中添加一个可绘制的形状。它取决于您,如果需要,请自定义它。) :
Here is my example of a RadioGroup with custom border (with corner radius) and custom divider ShapeDrawable(s).
