Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Absolute Layout Sizing

$
0
0

Using Absolute Layouts allows for positioning objects onto a definite spot within that layout. It does this based off of coordinates within the layout. You put in those coordinates, the object sets itself within them. However, my problem lies in the fact that for the iPhone 5s on down, the width of the screen is much smaller than the iPhone 6 on up, thus throwing off the positioning of the absolute layout.

In my exact scenario, I'm using a Stack Layout that contains many items, one of which is an Absolute Layout that contains a couple of items for itself. I've set up the coordinates so that the two objects within the Absolute Layout are stacked on top of each other, and then the rest of the Stack Layout items are underneath. However, I'm always left with a large gap between the Absolute Layout and the rest of the items. I tried giving the Absolute Layout a defined height proportional to the size of the screen, and that worked, but only for the screen size I'd sized it to. Change screen sized (switching from iPhone 6 to iPhone 5) and now things are out of whack again since the screen sizes are different.

So in the end, my question is this: Is there a way to set an Absolute Layout to only take up as much room as needed and use actual positioning properties instead of placing objects with coordinates? (e.g., "top left" instead of "0, 0") Thank you in advance!

(BTW, below I have two rough sketches: the first is what I'm aiming for and the second is what I getting.)


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>