开发者

How to enable Addressbar in Android WebView?

I´m actually using a WebView in my Application and it works pretty good. Now I´d like to be able to change the actual URL, just like that Addressbar in 开发者_如何转开发the Android Stock browser, where you can see the URL and where you simply can change it.

How can I enable this bar? Or do I have to implement it myself?! Thanks!

My Code looks like:

private void setupWebView() {
    webview = new WebView(this);
    webview.setWebViewClient(new MyWebViewClient());
    WebSettings webSettings = webview.getSettings();
    webSettings.setUserAgentString("foo");
    webSettings.setJavaScriptEnabled(true);
    webSettings.setAppCacheEnabled(false);
    webSettings.setBuiltInZoomControls(true);
    webview.setWebChromeClient(new WebChromeClient() {
        public void onProgressChanged(WebView view, int progress) {
            MyActivity.this.setProgress(progress * 100);
        }
    });
}


Impossible:

The WebView class is an extension of Android's View class that allows you to display web pages as a part of your activity layout. It does not include any features of a fully developed web browser, such as navigation controls or an address bar. All that WebView does, by default, is show a web page.

http://developer.android.com/guide/webapps/webview.html

If you want to change URL by code:

WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.loadUrl("http://www.example.com");
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜