【发布时间】:2020-05-22 14:16:52
【问题描述】:
我有一个将以编程方式填充的 RadioGroup(我正在使用 kotlin),我想更改单选按钮的圆形颜色(尽量避免强调色解决方案)。
** XML
<RadioGroup
android:id="@+id/radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp" />
** 科特林
for (entry in entries) {
val rb = RadioButton(applicationContext)
rb .text = entry
rb .id = entries.indexOf(entry) + 100
rb .setTextColor(Color.BLACK)
rb .isChecked = (entries.indexOf(entry) == 0)
rbg.addView(rb)
}
【问题讨论】:
-
它适用于 api > 21 但我认为 api 16
标签: android android-layout kotlin android-radiobutton