How to have a full-size stacklayout within a absolutelayout

TheMillerTheMiller USMember ✭✭
edited March 2018 in Xamarin.Forms

Hello there!

I encounter a width-problem, that I broke down to AbsoluteLayout and StackLayout. At first, I wanted to integrate AdMob-Banner-Ads. In general, they are displayed correctly. But when I place them within a StackLayout (which itself is in a AbsoluteLayout), AdMob says "Not enough space for the ad banner".
And I am "forced" to have an AbsoluteLayout because I want to show an ActivityIndicator-Popup while fetching data.

My Layout is the following:

            -[Alternatively here the AdMobView]

in xaml it is the code

    <AbsoluteLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">

        <!-- AdMob -->
        <ads:AdMobView AdUnitId="{Binding AdUnitId}" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1" />

        <StackLayout AbsoluteLayout.LayoutFlags="SizeProportional"  AbsoluteLayout.LayoutBounds="0,0,1,1" Orientation="Vertical" IsEnabled="True">
            <SearchBar Placeholder="Find ..." Text="{Binding SearchText}">
                        <cmd:EventToCommandBehavior EventName="TextChanged" Command="{Binding SearchCommand}" />
        <!-- ActivityIndicator Popup -->
        <StackLayout IsVisible="{Binding ShowActivityIndicator}" AbsoluteLayout.LayoutFlags="PositionProportional" AbsoluteLayout.LayoutBounds="0.5,0.5,-1,-1">
                <Frame CornerRadius="10" HasShadow="False" BackgroundColor="#BB000000">
                    <ActivityIndicator Color="White" WidthRequest="80" HeightRequest="80" IsRunning="{Binding ShowActivityIndicator}" VerticalOptions="Center" HorizontalOptions="Center" />

I hope somebody can help me. I checked my margins and padding to be 0px. Outside the AbsoluteLayout the Adbanner is being displayed. Somewhere some pixels "are getting ate", so that the isn't the full-width available, but AdMob needs the full-width. I have no idea what to do/test now.

Thanks in advance


Sign In or Register to comment.