开发者

Keeping a webView contained in Android?

开发者 https://www.devze.com 2023-03-07 22:10 出处:网络
Hey everyone! Im pretty new to Android and I have a webView under 2 other widgets on the screen(Or w/e you call it). But when ever I navigate the webView, its c开发者_C百科hanges to full screen and i

Hey everyone! Im pretty new to Android and I have a webView under 2 other widgets on the screen(Or w/e you call it). But when ever I navigate the webView, its c开发者_C百科hanges to full screen and i cant see my other widgets. Ive looked all over Google but couldn't find anything, is there some way I can fix this?

Im using this code to navigate:

webView.loadUrl("http://www.example.com/");

Thank you.


webview.setWebViewClient(new WebViewClient() {
    public boolean shouldOverrideUrlLoading(WebView view, String url){
        view.loadUrl(url);
        return true;
   }
});

when you do webView.loadUrl("www.example.com") or if there is a redirection when a hyperlink is clicked or something similar, the android device browser is started. I believe you are stuck with this. Try pasting the above code before you call the webView.loadUrl("www.example.com")

What we are essentially doing is asking the webview to load the url, instead of opening it in the device browser.

0

精彩评论

暂无评论...
验证码 换一张
取 消