机器人:web视图里面对话框或弹出 [英] android: webview inside dialog or popup

查看:156
本文介绍了机器人:web视图里面对话框或弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何添加里面的对话框或弹出窗口的Web视图。

how to add web view inside dialog or popup window.

我的Web视图保持URL WebView.loadurl()。当视图中添加对话框内它仍然移动浏览器。

my web view hold URL WebView.loadurl() .when view added inside dialog it still moving to the browser.

我已经在机器人装载的WebView对话框 但是如何做到这一点没有任何例子吗? 谢谢

I've been in android loading webview in dialog but is no example of how to do it? thanks

推荐答案

下面是例子:

AlertDialog.Builder alert = new AlertDialog.Builder(this); 
alert.setTitle("Title here");

WebView wv = new WebView(this);
wv.loadUrl("http:\\www.google.com");
wv.setWebViewClient(new WebViewClient() {
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        view.loadUrl(url);

        return true;
    }
});

alert.setView(wv);
alert.setNegativeButton("Close", new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int id) {
        dialog.dismiss();
    }
});
alert.show();

这篇关于机器人:web视图里面对话框或弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆