Web view flicker/blinks while scrolling

后端 未结 3 1692
Happy的楠姐
Happy的楠姐 2021-02-04 15:59

I am working on hybrid application, there are HTML5 files which i bundled within application. I need to play video on some HTML pages for that i used android:hardwareAcc

3条回答
  •  广开言路
    2021-02-04 16:21

    It seems that the android:hardwareAccelerated="true" is the root of the problem. If you really need it, you can solve this issue by calling:

    webView.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
    

    It requires API level 11, so you can wrap it in a method like this:

    @TargetApi(11)
    protected void configureLayerType(WebView webView) {
        webView.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
    }
    

提交回复
热议问题