Sign in Go Pro

Constraint Layout

Center Constraints

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next

Previous

About

In this lesson, we will talk about how center constraints, which build on edge constraints to size a view by its center rather than its individual sides. Using center constraints, we can perform horizontal and vertical centering of views within a `ConstraintLayout`, similar to using gravity in other layouts. We will look at how to create center constraints both in the Layout Editor as well as in XML. We will also discuss how remaining space is incorporated into and distributed at the ends of a center constraint via a **bias** and look and at how the combination of margins and bias can affect how center constraints position a view. Also we will look at how to specify bias in both the Layout Editor and in XML.

Lessons in Constraint Layout