Skip to content

Dimension Constraints

Nicolas Roard edited this page Mar 11, 2021 · 5 revisions

layout_constraintWidth and layout_constraintHeight

Those new attributes can be used as a replacement of android:layout_width and android:layout_height as well as several other ConstraintLayout attributes.

The different possibilities are:

  • dimension (e.g. 123dp)
  • match_parent
  • wrap_content
  • match_constraint (equivalent to 0dp with android:layout_width/height)
  • wrap_content_constrained (equivalent to wrap_content + constrainedWidth/Height=true with android:layout_width/height)
  • ratio=w:h or float
  • weight=float
  • parent=float (percent of parent)