suggest change




ConstraintLayout is a ViewGroup which allows you to position and size widgets in a flexible way. It is compatible with Android 2.3 (API level 9) and higher.

It allows you to create large and complex layouts with a flat view hierarchy. It is similar to RelativeLayout in that all views are laid out according to relationships between sibling views and the parent layout, but it’s more flexible than RelativeLayout and easier to use with Android Studio’s Layout Editor.


- public void addView(View child, int index, ViewGroup.LayoutParams params)
- public ConstraintLayout.LayoutParams generateLayoutParams(AttributeSet attrs)
- public void onViewAdded(View view)
- public void onViewRemoved(View view)
- public void removeView(View view)
- public void requestLayout()

- protected boolean checkLayoutParams(ViewGroup.LayoutParams params)
- protected ConstraintLayout.LayoutParams generateDefaultLayoutParams()
- protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams params)
- protected void onLayout(boolean changed, int left, int top, int right, int bottom)
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
- public void resolveLayoutDirection(int layoutDirection)
- public void validate()

- protected void setBaseAttributes(TypedArray a, int widthAttr, int heightAttr)


Parameter | Details | ——— | —–– | child | The View to be added to the layout | index | The index of the View in the layout hierarchy | params | The LayoutParams of the View | attrs | The AttributeSet that defines the LayoutParams | view | The View that has been added or removed | changed | Indicates if this View has changed size or position | left | The left position, relative to the parent View | top | The top position, relative to the parent View | right | The right position, relative to the parent View | bottom | The bottom position, relative to the parent View | widthMeasureSpec | The horizontal space requirements imposed by the parent View | heightMeasureSpec | The vertical space requirements imposed by the parent View | layoutDirection | - | a | - | widthAttr | - | heightAttr | - |


At Google IO 2016 Google announced a new Android layout named ConstraintLayout.

Pay attention because currently, this layout is a Beta release.

Fore More About Constraint Layout:

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents