Advanced Explanation of Android Layout Properties? -
i'm on quest learn how layout components in android. i'm seasoned css/mxml developer , having hardest time getting full understanding of layout properties in android components.
one thing i'm not sure differences between these:
- layout_margin vs. padding
- layout_gravity vs. gravity vs. ignoregravity
should use 1 on other linear, table or relative layouts? example of i'd learn having overall margin on layout separate components relating top/middle/bottom of screen. sdk docs start, don't show how things work in different situations.
any tips on go learn more complex/comprehensive layout design?
any attribute prefix layout_
layoutparams
attribute. while view attributes parsed during view construction view itself, layoutparams special arguments parent view provide hints how parent should size , position child view. layoutparams valid on view depends entirely on type of parent view.
layout_margin
therefore instruction parent view supports margins. says, "put space between me , other views or edge of parent." padding space inside view between view's edges , content.
layout_gravity
gravity single child within parent. gravity
affects contents of view appears on.
which 1 use depends on result want achieve. if want layout have fixed amount of space between edges , of contents, want padding. if want move layout's own edges in distance, want margins. when have layouts without backgrounds set, these 2 can visually equivalent. when start creating complex uis layouts have 9-patch backgrounds visually group contents differences become apparent.
Comments
Post a Comment