【问题标题】:Open javascript window into AlertDialog在 AlertDialog 中打开 javascript 窗口
【发布时间】:2012-01-11 10:10:20
【问题描述】:

在我的应用程序中,我有一个正确显示的 web 视图。 在该站点中有一个按钮,单击该按钮时会显示一个 window.open() 显示一些信息。 我添加了一个覆盖 onCreateWindow 方法的 webchromeclient,并将 setSupportMultipleWindows(true) 添加到 webview。 它被调用,但我不知道如何将页面内容显示到对话框中或如何在 webview 的新窗口中显示此页面。 有什么建议吗?

【问题讨论】:

    标签: android webview window.open webchromeclient


    【解决方案1】:

    在您的onCreateWindow() 实现中,您需要这样的东西:

    WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
    
    // Create a new WebView here and display it to the user
    newWebView = ...
    
    transport.setWebView(newWebView);
    resultMsg.sendToTarget();
    
    return true;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-02-26
      • 1970-01-01
      • 1970-01-01
      • 2012-12-07
      • 1970-01-01
      • 1970-01-01
      • 2011-01-07
      • 2012-12-17
      相关资源
      最近更新 更多