E
E
Eugene2019-08-23 21:38:04
Android
Eugene, 2019-08-23 21:38:04

When to use ConstraintLayout when laying out?

Good evening. Is it worth using a constraint when laying out partly simple layot ​​(this simple one that can be laid out simply as a linear without weights). I read that the StartToStart bindings and others load the percentages a bit because they calculate the layout size and position. But suddenly I'm wrong and constrain is somehow optimized? I would be grateful if you send me recommendations for layout.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
terminator-light, 2019-08-25
@evgdev

Not worth it. If it is possible to bypass ConstraintLayout (CL) and achieve a flat hierarchy of layouts, use Linear/Relative/Frame -layouts. After all, CL inside itself solves systems of linear equations. For simple layouts, using it can make it harder to read and slower performance than the ones above.
CL should be used when, with normal layouts, the nesting level becomes large. Increasing the nesting can affect performance, and here CL will be effective.
It should be used when its capabilities are needed (aspect ratio, chains, group, guideline, barrier, percent sizes, circular, etc.)
CL should not be used for ordinary Views as elements for RecyclerView.
Links to other answers:
What is ConstraintLayout for?
What's with the performance of RelativeLayout / Constra...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question