Interview frequency: …
Short answer
It lets you build complex UIs with a flat hierarchy without nesting containers, which reduces the cost of double measure and layout.
Explanation
When several LinearLayouts that use layout_weight are nested, the system has to run multiple measure passes for each nesting level (double taxation), which negatively affects UI rendering. ConstraintLayout resolves all the relative relationships between elements (such as alignment, percentages, chains, and guidelines) in a single flat mathematical measurement step.
Code example
<!-- Flat UI with clear constraints -->
<androidx.constraintlayout.widget.ConstraintLayout ...>
<ImageView
android:id="@+id/avatar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" ... />
<TextView
android:id="@+id/title"
app:layout_constraintStart_toEndOf="@id/avatar"
app:layout_constraintTop_toTopOf="@id/avatar" ... />
</androidx.constraintlayout.widget.ConstraintLayout>Common mistakes
- Using ConstraintLayout everywhere, even for very simple UIs made of two elements, where a regular LinearLayout is faster and lighter.