【问题标题】:Xamarin.Forms WebView not rendering position:fixed css correctly?Xamarin.Forms WebView 不呈现位置:正确固定 css?
【发布时间】:2017-03-27 17:32:41
【问题描述】:

我正在尝试使用仅查看我的网站的 Xamarin 表单在 Xamarin 中构建跨平台应用程序。 大多数东西都运行良好,但我在 Android 下遇到了一个大问题。我做了一个不使用 Xamarin Forms 的测试 Xamarin 应用程序,只是 Xamarin 提供的本机 Android 东西,以测试它是否只是一个 Forms 问题。原来它似乎是……

问题似乎是 Xamarin Forms WebView 非常错误地呈现“位置:固定”的 css,而在“本机”Xamarin Andoid 应用程序下,一切都按预期呈现。

现在据我了解,Xamarin Forms 应该使用与“本机”应用程序的 html 渲染器相同的底层 html 渲染器,我认为它是 Android 4.4 及更高版本下的 Chromium。

不是这样吗?也许这是一个已知的错误?或者只是我这边的设置问题?


以下是说明该错误的图像。如您所见,右侧的蓝色大条未正确渲染。

这是应用程序为说明错误而呈现的测试 HTML:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
    <div style="background: blue; height:100px; width: 100%; position:fixed; left: 0; top: 0;">
        <div style="margin:0 auto; width: 200px;">
            <p style="color: white;">HELLO WORLD</p>
        </div>
    </div>
</body>


对此的任何帮助将不胜感激!
谢谢,
巴斯

【问题讨论】:

  • 面临同样的问题。修好了吗?

标签: android css mono xamarin xamarin.forms


【解决方案1】:

问题不在 html 中。在 WebView 上添加高度或将其放在 Grid 行中。

https://developer.xamarin.com/guides/xamarin-forms/user-interface/webview/

【讨论】:

    猜你喜欢
    • 2017-12-04
    • 1970-01-01
    • 2017-02-13
    • 1970-01-01
    • 2012-02-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多