WebView must be loaded twice to load correctly

后端 未结 3 1616
一生所求
一生所求 2020-12-11 07:03

When the page with the WebView first loads, sometimes images are missing or displayed incorrectly. If I reload the page the WebView always displays perfectly. I know everyon

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-11 07:30

    Please try this instead of your way, that is a bad practice:

            learnWebView.post(new Runnable() {
    
                @Override
                public void run() {
                    learnWebView.loadUrl("myurl");
                }
            });
    

    Or this, in case the first one wont work:

            learnWebView.postDelayed(new Runnable() {
    
                @Override
                public void run() {
                    learnWebView.loadUrl("myurl");
                }
            }, 500);
    

    Hope this helps.

提交回复
热议问题