.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,578 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
In my MAUI project, I used AbsoluteLayout to define a UI design. However, I found that AbsoluteLayout height proportional is not the same as in Portrait and Landscape.
The height size differs, For example,
In Portrait mode,
In Landscape mode,
I define a height as below,
protected override void OnSizeAllocated(double width, double height)
{
base.OnSizeAllocated(width, height);
screenWidth = width;
screenHeight = height;
double lytheight = screenHeight * 0.10;
AbsoluteLayout.SetLayoutBounds(stkNavigationBar, new Rect(0, 0,width,lytheight));
}
10% of the screen height I gave to the layout, but in landscape mode, the height size is small when comparing portrait mode.
is there any way to make the height size is same in both portrait and landscape mode?
That would be a fixed height rather than %. You could also do a % of the larger of width and height.