WebView Rendering Issue in Android KitKat

后端 未结 5 1725
终归单人心
终归单人心 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:29

    The disabling of the hardware accelerator comes with heavy performance toll, In my case I found out that in Kitkat this happened to me when I was re instantiating the webview element within an activity that was finished and later restarted. After a lot of trial and error, when I added:

    RelativeLayout layout = (RelativeLayout) findViewById(R.id.webViewContainer);
    layout.removeAllViews();
    webview.destroy();
    

    Just before ending the activity, it seems to have the problem solved. I haven't tested it on many devices yet but if this solution is proper, then it is better by far than disabling the hardware acceleration for KitKat for the webview.

提交回复
热议问题