WebView Rendering Issue in Android KitKat

后端 未结 5 1719
终归单人心
终归单人心 2020-11-30 00:01

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, i

5条回答
  •  情话喂你
    2020-11-30 00:17

    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.

    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);
    

提交回复
热议问题