I've tried a couple of ways to achieve it programmatically but none worked for me except following. Dropping it here, in case someone finds it helpful.
<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/radio_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null" />
Create a ColorStateList
private fun getRadioButtonColor(): ColorStateList {
val states = arrayOf(
intArrayOf(-android.R.attr.state_checked),
intArrayOf(android.R.attr.state_checked))
val colors = intArrayOf(
ContextCompat.getColor(context, R.color.grey2),
ContextCompat.getColor(context, R.color.actionBlue)
)
return ColorStateList(states, colors)
}
And then use setButtonTintList from CompoutButtonCompat class to set this colorStateList
CompoundButtonCompat.setButtonTintList(radio_btn, getRadioButtonColor())