Xamarin Forms Absolute Layout instead of Relative Layout

Viewed 764

Since Jason Smith didn't recommend Relative layout and said that we should use Absolute layout I have a question how can we deal with RelativeToView concept?

Absolute Layout sets proportional coordinates and sizes of the elements within itself relative to itself not to each other as RelativeLayout. What to do if I need some elements to be relative to each other? Creating additional Grids and StackLayouts? I would rather use RelativeLayout then or I am missing something.

Decided to add a simplest example and consider we are talking ONLY about Relative and Absolute layouts, no Stack, no Grid. I have 2 buttons and I want to place them as shown in the picture

enter image description here With absolute layout I could define the position of the top button and say it's height 10% of the screen. Now I could shift the bottom button by saying it starts at 11% of the screen. BUT this will change my top button height. If I want my top button to be it's natural "auto" size I cannot do that. So, how can I put my bottom button under top one if I have no idea how much top button occupies on screen? I know how to do it with Relative but how I can do it with Absolute Layout?

It looks like the solution is nest bunch of layouts https://developer.xamarin.com/guides/xamarin-forms/user-interface/layouts/absolute-layout/ Is that the only way? Is that performance still better than Relative layout?

1 Answers
Related