fun RadioButton.setStartCheckedIndicator() { val attr = context.theme.resolveAttribute(android.R.attr.listChoiceIndicatorSingle) val buttonDrawable = AppCompatResources.getDrawable(context, attr) buttonDrawable?.apply { setBounds(0, 0, intrinsicWidth, intrinsicHeight) } putCompoundDrawablesRelative(start = buttonDrawable) }
In devices with Android 6, when we use android:button="@null" android:drawableStart doesn't work via xml as a result we have to apply it programmatically. More info about this issue https://github.com/mozilla-mobile/fenix/issues/1414