I have created my layout with ConstraintLayout and as ConstraintLayout allows you to build complex layouts without having to nest View. In my case, I want multiple view click events.
I have tried using Group as you can get a list of ids that are members of your Group in your code and set click listener.
fun Group.setAllOnClickListener(listener: View.OnClickListener?) {
referencedIds.forEach { id ->
rootView.findViewById<View>(id).setOnClickListener(listener)
}
}
However, this does not seem to work as of the ConstraintLayout version 2.0.0-beta2. This code is working till 2.0.0-alpha3. I have implemented using multiple ConstraintLayout so is it alright to use nested constraint layout?
I am using MotionLayout and other animation of constraint layout so I can't use a lower version of ConstraintLayout.