为什么我在WebViewClient里设置true时页面空白,而设置为false时,网页在webview中打开了
public class MainActivity extends AppCompatActivity {
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
init();
}
private void init() {
webView= (WebView) findViewById(R.id.webview);
webView.loadUrl("http://baidu.com");
webView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return false;
}
});
}
}