android - when to use the relative layout and constrain layout with real time example -


could please me out letting me know when use relative layout , when use constrain layout example in android.

first need know why constraintlayout introduced later in android sdk.

why constraintlayout introduced?

using relative , other layouts, need create hierarchy of different views. these hierarchy can long multiple nested view groups.

when android renders layout, views rendered going level below in nested layouts. more levels, requires more time.

so according android documentation,

constraintlayout allows create large , complex layouts flat view hierarchy (no nested view groups).

which can take lesses time other nested views.

what difference between constraintlayout , relativelayout?

constraintlayout similar relativelayout in views laid out according relationships between sibling views , parent layout, it's more flexible relativelayout.

when choose layout? if screen has design such can using no nested relativelayout, use relative or else use constraint.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -