Android Developer Malaysia

At Google IO 2016 Google introduced a brand new Android layout named ConstraintLayout. Regardless of the initial release being labelled being an Alpha release, android developer Malaysia really pretty stable (having a couple of caveats). Within this number of articles we’ll check out this new layout-kid on the market and check out and obtain some information in terms best for doing things.

Constraint propertiesBefore we obtain to the nitty gritty of ConstraintLayout it’s worth a short discussion about why it’s important. The very first reason is performance. It’s been well recorded that deep layout hierarchies are extremely costly with regards to the measurement and layout passes. We are also told that nesting weighted LinearLayouts is inefficient and really should be prevented – it is because each child must be measured two times and thus, once we nest them, then quantity of dimensions per child develops tremendously for every nested layout level. Similarly RelativeLayout has similar double-measurement issues and also the advice originating from Bing is to prevent them because the top-level container.

The nested, weighted LinearLayout issue continues to be partially addressed by PercentLayout, and also the RelativeLayout issue continues to be partially addressed by GridLayout. However, as numerous designers knows, it is sometimes essential to not in favor of the recommendation originating from Google due to the fact these designs are the type ideal to making the designs our designers provide us with.

Which raises another issues – which top-level layout must i use? Getting this alternative right is definitely an time tested condition in Android development and it is something that can’t be trained – it might be almost instinctive with experience. However, no quantity of experience can guard from the designer making some allegedly trivial changes towards the layout that have big implications with regards to the layout hierarchy and need an entire re-organisation of the working layout.

ConstraintLayout is particularly made to replace RelativeLayout as well as in nearly all cases only needs a single measurement of kid Sights inside the layout pass – there are several cases when double dimensions are needed, however the designers know about these and therefore are trying to either get rid of them or, a minimum of, lessen the effect on performance. android developer Malaysia also designed is the default top-level layout container and finest practice would be to avoid nesting other designs within the ConstraintLayout. By continuing to keep design flattened in this manner additionally, it cuts down on the exponential increase in dimensions for that double-measurement cases because we shouldn’t have to add child designs.

The fundamental concept behind ConstraintLayout is the fact that child Sights have many anchor suggests that your constraint could be attached for that left, top, right, or bottom edges or even the text baseline for icons that have text. A constraint links an anchor point in one View for an anchor reason for a brother or sister View, or even the parent. These constraints provide similar types of functionality towards the Relativelayout.LayoutParams characteristics. Much like RelativeLayout we are able to set margins to produce offsets. However it doesn’t hold on there – on the top of the we are able to also set bias values which let us create offsets based on ratios from the available space. These bias values used along with different layout_[widthheight] values can provide us some nice control of the way the individual child Sights are really sized.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s