我想改变单选按钮的圆圈颜色,我无法理解要设置的属性.我所拥有的背景颜色是黑色,因此它变得不可见.我想将圆圈的颜色设置为白色.
我想知道它是否可能以编程方式以及如何在选中时以编程方式更改 RadioButton 的颜色?
PS:我不想使用 XML
在 XML 中,我使用了这样的东西及其工作:
<RadioButton
android:id="@+id/radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test1"
android:textColor="@color/red"
android:textSize="16dp"
android:paddingStart="10dp"
android:paddingEnd="0dp"
android:theme="@style/CustomColorRadioButton" />
Run Code Online (Sandbox Code Playgroud)
在我的 style.xml
<style name="CustomRadioButton" parent="AppTheme">
<item name="colorControlActivated">@color/blue</item>
</style>
Run Code Online (Sandbox Code Playgroud)
我怎样才能以编程方式做到这一点?