Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ConstraintLayout cannot replace RelativeLayout or LinearLayout?

I've learned about the ConstraintLayout which is much more flexible than RelativeLayout or LinearLayout. I am wondering if I can use it rather than RelativeLayout or LinearLayout. But I have a situation where I find ConstraintLayout can't do what I want, if it doesn't contain a nested viewgroup.

For instance, what if I want to do animation to a group of views (which could have been put into a LinearLayout) or I want to have a scrollview?

For the all things above, I still have to have a nested viewgroup.

How can I achieve this with ConstraintLayout?

like image 891
Allen Vork Avatar asked Mar 25 '26 18:03

Allen Vork


1 Answers

You can nest other layouts inside ConstraintLayout. The whole point is you avoid multiple nesting using it, not all the nesting altogether.

Constraint Layout: This new layout is a flexible layout manager for your app that allows you to create dynamic user interfaces without nesting multiple layouts. It is distributed as a support library that is tightly coupled with Android Studio and backwards compatible to API Level 9.

like image 149
Jan Slominski Avatar answered Apr 02 '26 11:04

Jan Slominski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!