ConstraintLayout

suggest change

Versions

[{“Name”:“2.3”,“GroupName”:null},{“Name”:“2.3.3”,“GroupName”:null},{“Name”:“3.0.x”,“GroupName”:null},{“Name”:“3.1.x”,“GroupName”:null},{“Name”:“3.2.x”,“GroupName”:null},{“Name”:“4.0”,“GroupName”:null},{“Name”:“4.0.3”,“GroupName”:null},{“Name”:“4.1”,“GroupName”:null},{“Name”:“4.2”,“GroupName”:null},{“Name”:“4.3”,“GroupName”:null},{“Name”:“4.4”,“GroupName”:null},{“Name”:“4.4W”,“GroupName”:null},{“Name”:“5.0”,“GroupName”:null},{“Name”:“5.1”,“GroupName”:null},{“Name”:“6.0”,“GroupName”:null},{“Name”:“7.0”,“GroupName”:null},{“Name”:“7.1”,“GroupName”:null}]

Introduction

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.

Syntax

- 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)

Parameters

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 | - |

Remarks

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:

https://codelabs.developers.google.com/codelabs/constraint-layout/index.html

Feedback about page:

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


ConstraintLayout:
* ConstraintLayout
* Chains

Table Of Contents
2 Gradle
5 Intent
17 Service
19 WebView
31 SQLite
35 Glide
37 Dialog
38 ACRA
44 Handler
53 Toast
63 Menu
65 Picasso
70 Volley
71 Widgets
78 Realm
90 Spinner
95 OkHttp
108 TextView
109 ListView
111 Loader
118 Xposed
119 Security
121 ImageView
123 Doze Mode
130 Drawables
131 Colors
132 ConstraintLayout
134 Fresco
139 AdMob
145 Keyboard
146 Button
150 EditText
155 Vk SDK
163 ExoPlayer
169 XMPP
175 OpenCV
177 Threads
184 ORMLite
186 TabLayout
190 LruCache
192 Zip files
194 Fastlane
199 FileIO
202 Moshi
210 VideoView
216 Paint
218 ProGuard
226 CleverTap
228 ADB shell
229 Ping ICMP
230 AIDL
234 Context
240 JCodec
242 Okio
249 FuseView
254 Looper
261 Fastjson
263 Jackson
267 Smartcard