locked
How to change the webview resolution? RRS feed

  • Question

  • User105238 posted

    I created a webpage for an indoor map application which use javascript canvas 2D for rendering. I manage to display the website in mobile phone using webview however the font size and line width in webview is bigger than in chrome browser. I check the resolution in mobile chrome browser it return me width 980, height 1524 but in xamarin webview it return me width 360, height 584. Anyone know how to set the webview screen to higher resolution? Thanks in Advance!

    Tuesday, July 28, 2020 3:29 AM

Answers

  • User105238 posted

    I found the solution already, just update the following code:

    Control.Settings.LoadWithOverviewMode=true;
    Control.Settings.UseWideViewPort = true;
    
    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, July 29, 2020 3:04 AM

All replies

  • User382871 posted

    I check the resolution in mobile chrome browser it return me width 980, height 1524 but in xamarin webview it return me width 360, height 584. The browser and webview don't have a separate resolution, the resolution value is designed by the screen. Different values of width and height are caused by the browser configuration and the webview's size.

    Anyone know how to set the webview screen to higher resolution? We cannot to set a resolution for the webview. To avoid to display different effect in the webview and the browser, try to open the browser to display the page url in the application with Xamarin.Essentials.Browser.

    public async Task OpenBrowser(Uri uri) { await Browser.OpenAsync(uri, BrowserLaunchMode.SystemPreferred); }

    Tuesday, July 28, 2020 8:11 AM
  • User105238 posted

    @YelinZh said:

    I check the resolution in mobile chrome browser it return me width 980, height 1524 but in xamarin webview it return me width 360, height 584. The browser and webview don't have a separate resolution, the resolution value is designed by the screen. Different values of width and height are caused by the browser configuration and the webview's size.

    Anyone know how to set the webview screen to higher resolution? We cannot to set a resolution for the webview. To avoid to display different effect in the webview and the browser, try to open the browser to display the page url in the application with Xamarin.Essentials.Browser.

    public async Task OpenBrowser(Uri uri) { await Browser.OpenAsync(uri, BrowserLaunchMode.SystemPreferred); }

    I try open with Xamarin.Essentials.Browser and it give me width 980, height 1524 which is same as mobile chrome browser resolution, but why the webview give only width 360, height 584? How to make webview take the same resolution as the mobile browser?

    Wednesday, July 29, 2020 2:09 AM
  • User105238 posted

    I found the solution already, just update the following code:

    Control.Settings.LoadWithOverviewMode=true;
    Control.Settings.UseWideViewPort = true;
    
    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, July 29, 2020 3:04 AM