Android Layout Internals: RelativeLayout vs ConstraintLayout
viaGlassdoor
Question: Explain the internal workings of RelativeLayout and ConstraintLayout in Android — not just how to use them, but how each performs measurement and layout passes internally.
Answer outline: RelativeLayout resolves view positions relative to sibling views or the parent using a dependency graph, requiring up to two measure passes because a view's position can depend on another view measured after it. ConstraintLayout uses a constraint-solving system (based on the Cassowary algorithm) to resolve all view positions in a single pass, which generally makes it more performant for complex, nested-view-heavy layouts compared to deeply nested RelativeLayout/LinearLayout hierarchies.
asked …