xamarin.forms - Xamarin Forms Absolute Layout instead of Relative Layout -
since jason smith didn't recommend relative layout , said should use absolute layout have question how can deal relativetoview concept?
absolute layout sets proportional coordinates , sizes of elements within relative not each other relativelayout. if need elements relative each other? creating additional grids , stacklayouts? rather use relativelayout or missing something.
decided add simplest example , consider talking relative , absolute layouts, no stack, no grid. have 2 buttons , want place them shown in picture
absolute layout define position of top button , it's height 10% of screen. shift bottom button saying starts @ 11% of screen. change top button height. if want top button it's natural "auto" size cannot that. so, how can put bottom button under top 1 if have no idea how top button occupies on screen? know how relative how can absolute layout?
it looks solution nest bunch of layouts https://developer.xamarin.com/guides/xamarin-forms/user-interface/layouts/absolute-layout/ way? performance still better relative layout?
by nature relativelayout powerful , offers layouting options no other layout on own does. power comes @ cost in performance. resolving constraint dependencies consistently , obtaining final layout doesn't come cheaply.
the point not relativelayout
should never used, rather times other layouts can job, , yes, 2-3 nested layouts can more performant single equivalent relativepanel.
grid in particular powerful option similar effects can achieved astute use of auto, star, and/or absolute-sized rows , columns appropriate, plus rowspan , columnspan, plus element margins, etc.
to consider specific example, don't know of way achieve want absolutelayout
, @ least without added complication of attached properties. seems natural fit grid
rowspan="auto"
on first row. diagram alone can't tell other constraints you're going for.
Comments
Post a Comment