I have a RadioGroup
and I want to align buttons next to each other in two columns and five rows and I am unable to achieve it. Things I have tried:
this solution for handle click inside click body
xml :
code :
private var isChecking = true
mBinding.radioGroupAction1.setOnCheckedChangeListener { radioGroup, i ->
if (i != -1 && isChecking) {
isChecking = false
mBinding.radioGroupAction2.clearCheck()
}
isChecking = true
when (i) {
R.id.a -> {
Log.e("radioGroupAction:", "a")
}
R.id.b -> {
Log.e("radioGroupAction:", "b")
}
R.id.c -> {
Log.e("radioGroupAction:", "c")
}
}
}
mBinding.radioGroupAction2.setOnCheckedChangeListener { radioGroup, i ->
if (i != -1 && isChecking) {
isChecking = false
mBinding.radioGroupAction1.clearCheck()
}
isChecking = true
when (i) {
R.id.d -> {
Log.e("radioGroupAction:", "d")
}
R.id.e -> {
Log.e("radioGroupAction:", "e")
}
R.id.f -> {
Log.e("radioGroupAction:", "f")
}
}
}
Good Luck