Forum Visual Studio

Why does Xamarin HybridWebview not fill the screen on Android?

Hello everyone,
I am new to Xamarin and I am currently building an application which features a Xamarin Forms HybridWebView, just the one introduced on the official docs. (Cannot post links yet)
So far so good, everything works perfectly, but the HybridWebView does not occupy all of the screen space available... As seen here (I blurred out the content), there is a white bar underneath, it is not coming from the Page, since I defined a background-color and if I add Margins/Paddings I can see the color. So the Webview does not get rendered properly?

Here is my Layout:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:controls="clr-namespace:Project.Controls"
             mc:Ignorable="d"
             x:Class="Project.CustomWebViewPage"
             NavigationPage.HasNavigationBar="False"
             NavigationPage.HasBackButton="False"
             BackgroundColor="#313131"
             Padding="0">
    <ContentPage.Content>
        <StackLayout>
            <controls:HybridWebView 
            x:Name="hybridWebView" 
            BackgroundColor="#313131"
            Margin="0"
            />
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

and here, I initialize it:

            var hybridWebView = new Controls.HybridWebView
            {
                Uri = App.GLOBAL_URL,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            Padding = new Thickness(0, 0, 0, 0);
            Content = hybridWebView;

I have already tried:

  • Using Relative Layout
  • Using Absolute Layout
  • Setting Margin and Padding everywhere to 0
  • Using a Grid

Any help is very welcome, since I'm stuck with this for days..

Sign In or Register to comment.