WebView on Android 7.0+ doesn't render page

前端 未结 1 433
执笔经年
执笔经年 2021-02-06 10:45

I have WebView screen with license. And everything worked perfectly until users notified me that nothing shows on Android 7+ devices.

public class DefaultWebActi         


        
相关标签:
1条回答
  • 2021-02-06 11:48

    From Android doc

    This is pre Android N

    @Deprecated
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        return false;
    }
    

    This is since Android N

    • @return True if the host application wants to leave the current WebView
      • and handle the url itself, otherwise return false.
    @Override
        public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
            return true;
        }
    

    This method is from Android N , so for this reason you have this issue only in Android N. Returning false you should solve your problem.

    0 讨论(0)
提交回复
热议问题