Constraint layout is even better now!
Pankaj Rai
Sr Engr Cslt-App Dev Verizon | Google Developer Expert - Android, Firebase, AI/ML | Android Developer | Kotlin | Machine Learning | Generative AI
With the introduction of constraint layout it said that expressive UI can now be made with an ease but there were few of the thing which where missing like ability to define width and height in percentage, a proper guideline support but with the introduction of constraint layout version 1.1.0 so many new feature got added which makes it a complete tool to build a great expressive UI for android devices.
Here are the list of new features added in version 1.1.0
Circular Positioning: When a view need to be positioned based on another view with some angle and a distance measured from the center point of both the views. Think of a satellite revolving around planet with some angle and a distance.
Barrier: It’s having capability to create guideline at runtime based on the maximum width of the view available on the specified side.
Group: Well this is much awaited feature, what this can do is that if multiple views visibility need to set as visible or gone it can do it with an ease. Think of viewgroup containing various views and setting viewgroup visibility gone hide all its child views also. Group is having exactly same feature but it’s not viewgroup instead just require reference ids. A major boost for flat hierarchy layout.
Placeholder: It’s used to dynamically set content on screen where any view can be set to placeholder just by passing its id. If the view exists on same screen as placeholder is than its visibility will automatically be set to gone.
Dimension constraints: It’s often required that view width or height to remain as wrap content instead of match constraint or match parent but unfortunately wrap content override the constraint applied and overlap with the constraint if width or height changes with version 1.1.0 this issue is resolved. The one thing which truly constraint layout was missing is ability to define width and height in terms of percentage. Defining width or height in percentage is much more helpful to make an expressive UI as width or height in dp doesn’t work so well when viewed on mobile and tablet until different dimens are specified. But now width and height can be defined in terms of percentage.
There are few more cool features of constraint layout like achieving animation by using constraint set, optimizing layout using constraint optimizer and complex chain support. It’s good to see constraint layout is increasing capability to build a great UI.
For more information about how to use these great set of feature do checkout this article on medium.