Android的日食的WebView弹出不显示 [英] Android eclipse webview pop up not displaying
问题描述
所以,我有我的地方用一个弹出窗口,显示一条消息,如果有什么不工作,或只是为了证实事情的web应用程序。我已经对日食一个简单的Android应用程序通过Web视图中使用我的web应用程序,我所面临的问题是,它似乎是在应用内的Web视图不支持弹出窗口....我是对还是有围绕一个方式来显示弹出我的应用程序内的窗口?这里是code我用我的网络视图。感谢帮助提前。
So I have a web app where I use a pop up window to display a message if something is not working or just to confirm something. I have made a simple android app on eclipse to use my web app through a web view, the problem I'm facing is that it seem that the web view inside the app does not support pop up windows.... Am I right or is there a way around to display pop up windows inside my app? here is the code I'm using for my web view. thanks for helping in advance.
wvp = (WebView) findViewById(R.id.webView1);
wvp.getSettings().setJavaScriptEnabled(true);
wvp.setWebViewClient(new WebViewClient());
wvp.setInitialScale(1);
wvp.getSettings().setBuiltInZoomControls(true);
wvp.getSettings().setDisplayZoomControls(false);
wvp.getSettings().setUseWideViewPort(true);
所以,如果你有我在这里同样的问题是解决由于ksasq
So if you have my same problem here is the solution thanks to ksasq
wvp = (WebView) findViewById(R.id.webView1);
wvp.getSettings().setJavaScriptEnabled(true);
wvp.setWebViewClient(new WebViewClient());
wvp.setWebChromeClient(new WebChromeClient());
wvp.setInitialScale(1);
wvp.getSettings().setBuiltInZoomControls(true);
wvp.getSettings().setDisplayZoomControls(false);
wvp.getSettings().setUseWideViewPort(true);
wvp.getSettings().setSupportMultipleWindows(true);
wvp.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
本作的把戏是能够证明消息弹出窗口,我是后。享受!
this made the trick to be able to show that message pop up window I was after. enjoy!
推荐答案
有您需要做的几件事情:
There's a few things you need to do:
- 实施
WebChromeClient.onCreateWindow
[1] - 切换
WebSettings.setSupportMultipleWindows
[2]为true - 根据如何创建新的窗口,你可能需要启用
WebSettings.setJavaScriptCanOpenWindowsAutomatically
[3]
- Implement
WebChromeClient.onCreateWindow
[1] - Toggle
WebSettings.setSupportMultipleWindows
[2] to true - Depending on how the new window is created, you may need to enable
WebSettings.setJavaScriptCanOpenWindowsAutomatically
[3]
[1] <一个href=\"http://developer.android.com/reference/android/webkit/WebChromeClient.html#onCreateWindow%28android.webkit.WebView\" rel=\"nofollow\">http://developer.android.com/reference/android/webkit/WebChromeClient.html#onCreateWindow(android.webkit.WebView,布尔,布尔,android.os.Message)
[1] http://developer.android.com/reference/android/webkit/WebChromeClient.html#onCreateWindow(android.webkit.WebView, boolean, boolean, android.os.Message)
[2] <一个href=\"http://developer.android.com/reference/android/webkit/WebSettings.html#setSupportMultipleWindows%28boolean%29\" rel=\"nofollow\">http://developer.android.com/reference/android/webkit/WebSettings.html#setSupportMultipleWindows(boolean)
[3] <一个href=\"http://developer.android.com/reference/android/webkit/WebSettings.html#setJavaScriptCanOpenWindowsAutomatically%28boolean%29\" rel=\"nofollow\">http://developer.android.com/reference/android/webkit/WebSettings.html#setJavaScriptCanOpenWindowsAutomatically(boolean)
这篇关于Android的日食的WebView弹出不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!