Forum Xamarin.Android

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

The font size and line width in Webview is different from the mobile chrome browser

Cheng.9305Cheng.9305 USMember ✭✭
edited July 2020 in Xamarin.Android


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. Anyone know why? Thanks!

Here is the code :

`<?xml version="1.0" encoding="utf-8" ?>

<StackLayout>
    <Label Text="WebView with progess bar"  
       FontSize="40"  
       TextColor="BlueViolet"  
       BackgroundColor="White"/>
    <ProgressBar Progress="0.2"  
             HorizontalOptions="FillAndExpand"  
             x:Name="progress"  
             IsVisible="True"/>
    <WebView x:Name="Webview"             
         Navigating="OnNavigating"  
         Navigated="OnNavigated"  
         VerticalOptions="FillAndExpand"
             HorizontalOptions="FillAndExpand"  />
</StackLayout>


public MainPage()
{
InitializeComponent();

        Webview.Source = "http://indoormap.seedrawex.com/";
     }`

Best Answer

  • Cheng.9305Cheng.9305 USMember ✭✭
    Accepted Answer

    Hi,

    I think it is related to the screen resolution issue. So I will close this question and open another one.

Answers

  • YelinzhYelinzh Member, Xamarin Team Xamurai
    edited July 2020

    display the website in mobile phone using webview however the font size and line width in webview is bigger than in chrome browser.

    Because the content in the browser is not controlled by the system settings(such as font size), you could also check this in another browser. But app is different, the application is controlled by that thing. The webview belongs to the application which will be effected by the system setting.

  • Cheng.9305Cheng.9305 USMember ✭✭

    @YelinZh said:

    display the website in mobile phone using webview however the font size and line width in webview is bigger than in chrome browser.

    Because the content in the browser is not controlled by the system settings(such as font size), you could also check this in another browser. But app is different, the application is controlled by that thing. The webview belongs to the application which will be effected by the system setting.

    The content that shown in my web application are purely canvas 2D object, no html text, anything I can configure in xamarin form to achieve the same effect in mobile browser?

  • YelinzhYelinzh Member, Xamarin Team Xamurai
    edited July 2020

    anything I can configure in xamarin form to achieve the same effect in mobile browser

    We cannot change the setting of the browser. If the display content is the custom url, we could cusotmize the styles such as font-size.

  • Cheng.9305Cheng.9305 USMember ✭✭
    Accepted Answer

    Hi,

    I think it is related to the screen resolution issue. So I will close this question and open another one.

Sign In or Register to comment.