arun rastogi
arun rastogi

Reputation: 11

fit html based on user screen size using webView in MAUI

In my MAUI application I'm using webview to display my existing static html pages. But it is giving me scrollbars horizontally and vertically. I want my html page to adjust itself based on screen-size of device.

I tried to set MaximumHeightRequest & MaximumWidthRequest but it didn't worked for me. I want to have a dynamic solution for this problem.

Upvotes: 1

Views: 952

Answers (1)

user595
user595

Reputation: 172

Are you looking for this https://github.com/dotnet/maui/issues/8241. Look for @MobileDev327 comments

<ContentPage .....>
<ScrollView>
    <Grid>
        <Grid>
            <Label Text="By default, a Grid contains one row and one column" />
        </Grid>
        <Grid Padding="0,30,0,0">
            <WebView x:Name="jsExampleWebView" Source="Map.html"/>
        </Grid>
    </Grid>
</ScrollView>
Windows

enter image description here

Android Emulator

Android Emulator

Upvotes: 0

Related Questions