Android WebView renders blank/white, view doesn't update on css changes or HTML changes, animations are choppy

后端 未结 9 1515
不知归路
不知归路 2020-11-27 10:25

When ever I make a css class change, the changes don\'t always appear. This appears to happen when I have a touch event that adds something like a down class name to a butto

9条回答
  •  囚心锁ツ
    2020-11-27 10:36

    You should enable hardware by modifying your manifest:

    And in your activity onResume()

    webView.postDelayed(() -> {
        if (!isFinishing() && webView != null) {
            webView.setLayerType(View.LAYER_TYPE_NONE, null);
        }
    }, 1000);

    And in your onPause()

    webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

提交回复
热议问题