的WebView呈现的问题在Android的奇巧奇巧、问题、WebView、Android

2023-09-12 21:58:01 作者:暖色

我一直工作在其中有一个web视图,其中一个静态页面得到的资产(也使用JavaScript)加载的应用程序。此的WebView不是工作在奇巧,它仍然是空白。我知道在渲染引擎的变化(WebKit的铬),它发生在web视图中奇巧,并试图迁移的步骤,这是由于在Android开发者页面。但它并没有帮助。

I've been working on an application which have a WebView in which a static page get loaded from the assets (Also using JavaScript). This WebView is not working in KitKat, it remains blank. I am aware of the change in rendering engine (webkit to chromium) which happened in WebView in kitkat and tried the steps for migrating, which is given in Android Developers page. But it didn't help.

在logcat中我得到它是由铬源抛出一个错误。

In logcat I am getting an error which is thrown from the Chromium source.

W / AwContents:nativeOnDraw失败;清算背景颜色。

请提出一个解决办法。

感谢。

推荐答案

在我的情况下,在Android 4.4系统,我得到一个黑色的背景,无论我设置什么,在我的LogCat中此错误消息:nativeOnDraw失败;清除背景色。

In my case, in Android 4.4, I was getting a black background no matter I set what and this error message in my LogCat: nativeOnDraw failed; clearing to background color.

从谷歌搜索,这似乎是因为硬件加速的画布渲染,不支持在铬的WebView。我说这行到的WebView关闭硬件加速的画布和现在的作品。

From Googling, it seems to be because hardware accelerated canvas rendering is not supported in Chromium WebView. I added this line to the WebView to turn off hardware accelerated canvas and now it works.

mWebview.setLayerType(View.LAYER_TYPE_SOFTWARE, null);