链接应该是在Android的同一Web视图中打开 [英] Link should be open in same web view in Android
本文介绍了链接应该是在Android的同一Web视图中打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新的Android和我试图用这个code在web视图中打开链接
I am new in Android and I am trying to open a Link in webview using this code
WebView myWebView = (WebView) findViewById(R.id.webinfo);
myWebView.loadUrl("http://oslobokfestival.netteam.no/artical.php?articalid=93");
myWebView.setBackgroundResource(R.drawable.lbg);
myWebView.setBackgroundColor(Color.TRANSPARENT);
myWebView.getSettings().setJavaScriptEnabled(true);
在此HTML页面中包含一些链接,我想,当用户点击该链接应该是在同一个web视图打开, 在这一点上它的手机浏览器中打开,请给我合适的解决方案.. 谢谢。
and in this HTML page contains some links and I want that when user click that link should be open in same webview, at this point its opening in mobile browser, please give me appropriate solution.. Thanks.
推荐答案
您需要添加 WebViewClient 一>,以便在web视图中打开它你的WebView。类似于
You need to add WebViewClient to your WebView in order to open it in the WebView. Something like
myWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return false;
}
});
这篇关于链接应该是在Android的同一Web视图中打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文