Android WebView performance

后端 未结 4 1251
春和景丽
春和景丽 2020-12-08 05:32

In my app, I am loading a list of external url\'s in webview and allow user to flip through them. Webviews are loaded on to a view flipper. I find the performance is reall

4条回答
  •  被撕碎了的回忆
    2020-12-08 06:11

    I think the following works best:

    if (Build.VERSION.SDK_INT >= 19) {
        webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
    }       
    else {
        webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    

    Android 19 has Chromium engine for WebView. I guess it works better with hardware acceleration.

    For more info Android 4.4 KitKat, the browser and the Chrome WebView

提交回复
热议问题