How to Stay at the Top of Your Game at Work?

Once in a while we all have that nagging feeling that we could be doing better, bigger things at work if only we know how to do things the correct way. Sometimes all we need is a little motivation…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Advance Features of Constraint Layout

Constraint layout is the only way to build responsive layouts to fit any screen size further more its google recommended and Now default root layout in android! we definitely want you ❤

In this guide we will look into some of the advance feature of constraint layout which includes:

Groups

Barriers

Chains

Layout Optimizer

Often times we want some views to hide when certain conditions met, for example when result comes from API call we want some views to be hidden and some visible, in this scenario what we would have done (if we hadn’t know about groups) is set visibility to each of the views, but now as we know about the helper tool “group” we can set visibility to all views to whatever we want at once.

For this what you going to need is add group to your layout from design window and add all id’s of view that you want to apply changes to as reference ids in the group and thats it, now whenever you need to change visibility or any attribute just change attribute to group view

Barriers comes very handy we don’t want views to overlap when views size gets bigger unexpectedly , such as textviews if text coming from server we don’t know beforehand what will be the length of the text and if there is other textview next to it might get hidden behind the first textview, there are ways we can control this like constraint views to each other etc but optimal way is to use barriers, barrier is like guideline that keep views separated and moves views relative to each other and never overlap.

Chains as name suggests group views linearly in horizontal and vertical manner, there are different modes in which we can group views together, these are:

Spread (Evenly distributed views)

Spread inside (Fixed start and end views and remaining views gets evenly distributed)

Packed (views are tightly packed)

Weighted (Can give weight to views inside chain)

There are other things that makes constraint layout fit for using extensively beside flat hierarchy, these are:

ConstraintSet

Baseline

and more, that’s it!

Add a comment

Related posts:

Reclaiming What Was!!

The old ways done walked the plank!. “Reclaiming What Was!!” is published by Adam, The Diabetic Cyborg in MuddyUm.

How to Host a Virtual Whiskey Tasting

Alcohol brings people together. And it doesn't have to be in the bars or non-socially-distance-friendly establishments. Let the amber liquid help open conversation through the softly glowing screens…

Race to Mars

Upfront to be clear I am a fan of Elon Musk and his ability to think and execute on things which have never been thought of before. So yeah, he’s pretty much awesome to be clear. But the…