Android JS in WebView.loadUrl()

后端 未结 2 2067
孤城傲影
孤城傲影 2021-02-02 02:30

I want to load a webpage in WebView but remove parts of the webpage. So, I created a custom WebViewClient. And, in onPageFinished(), I did some javascript to remove some eleme

2条回答
  •  甜味超标
    2021-02-02 02:56

    You could try to speed up your WebView with:

    webview.getSettings().setRenderPriority(RenderPriority.HIGH);
    webview.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    

    Anyways, you shouldn't be making your WebView visible right away. Why don't you create an Interface (refer to http://developer.android.com/guide/webapps/webview.html, Binding JavaScript code to Android) and make a call from your javascript to:

    public void myCallback(){ view.SetVisibilitu(View.VISIBLE) };
    

    after the animations have ended?

提交回复
热议问题