I am trying to achieve a layout where the content has an image on background (positioned in bottom left corner, expanding 100% vertically and 60% horizontally)
The whole content is wrapped in an AbsoluteLayout, the main content is then a child to this layout and consists of StackLayout (and some other content inside).
The previewer in Visual Studio (Visual Studio Community 2017) shows the layout correctly - the image is below the content, the content is placed on middle as intended. However, both VS Emulator and Genymotion show the image above the content.
I trimmed the code to be as readable as possible (stripping it of styling)
...
<Frame VerticalOptions="End" AbsoluteLayout.LayoutFlags="All" Margin="0" Padding="0" IsClippedToBounds="True" AbsoluteLayout.LayoutBounds="0,1,0.6,1">
<Image Source="Graphic_Anna.png" />
</Frame>
<!-- Start: Actual Page Content -->
<StackLayout VerticalOptions="Center" AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All" x:Name="ApplicationLayoutContentLevel">
<Label Text="This is some text in main content" />
</StackLayout>
<!-- End: Actual Page Content -->
</AbsoluteLayout>
</ContentPage.Content>
...
The expected result is shown on this screenshot (from Previewer): https://i.sstatic.net/2ViL6.png
However, the result in both emulator seems to do this: https://i.sstatic.net/BNheE.png
Unfortunately, I don't have the option to test the app on an actual Android phone at this moment
Do you want to achieved like the following screenshot? I do not know which size that you used, so I cutout the picture from your screenshot.
If so, there is my code.If you want to achieve coveraged effect, I used two stacklayout
, the first layout will be covered by the second layout.Notice:If you set the VerticalOptions
will affect the AbsoluteLayout.LayoutBounds
<ContentPage.Content>
<AbsoluteLayout>
<StackLayout VerticalOptions="End" AbsoluteLayout.LayoutFlags="All" Margin="0" Padding="0" IsClippedToBounds="True" AbsoluteLayout.LayoutBounds="0,1,0.6,1">
<Image Source="Graphic_Anna.png" />
</StackLayout>
<!-- Start: Actual Page Content -->
<StackLayout AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0.8,0.7,0.5,0.5" x:Name="ApplicationLayoutContentLevel">
<Image Source="start.png" Scale="0.7"/>
<Label Text="10/10" TextColor="Black" FontSize="50" Margin="20,10,0,0"/>
<Label Text="Great job! you got everything" TextColor="Black" Margin="0,10,0,0" />
<Label Text="Back to games" TextColor="red" Margin="25,20,0,0" />
</StackLayout>
<!-- End: Actual Page Content -->
</AbsoluteLayout>
</ContentPage.Content>