0

i have a lots of child buttons in a toggle group. And i want that whenever one of the child is clicked, make the whole toggle group not clickable.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
kunal jaiswal
  • 25
  • 1
  • 5

1 Answers1

0

You can use the OnButtonCheckedListener() listener:

    materialButtonToggleGroup.addOnButtonCheckedListener { group, checkedId, isChecked ->
        for (i in 0 until materialButtonToggleGroup.childCount) {
            materialButtonToggleGroup.getChildAt(i).isClickable = false
        }
    }
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841