我正在尝试显示一个弹出对话框,里面有一张图片,点击时显示在网页视图中。我的问题是,弹出对话框没有弹出,但它在网页视图中全屏打开,或者在浏览器中打开。可以在webview中弹出吗?我使用了以下网页设置,但没有结果。
WebSettings settings = wvcontent.getSettings();
settings.setSupportMultipleWindows(true);
settings.setPluginsEnabled(true);
settings.setAllowFileAccess(true);
settings.setJavaScriptEnabled(true); 这是我的html内容。
html_content =
"<strong>"+title+"</strong>"
+ " <br><br><img src='"+single_image+" width='300' height='211'>"
+ "<br> "
+ ""+ content + "<br>"
+ str
+ "<div id='popup' style='display:none'>"
+ "<a id='popup-close' href='' class='button'>"
+ "Fermer"
+ "</a><p><img id='image-placeholder' width='300px';height='250px' src=''>"
+ "<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js'></script>"
+ "<script type='text/javascript'>
$(document).ready( function() {
$('.popup-open').click( function(e)"
+ "{$('#popup:visible').hide();
e.preventDefault();
$('#image-placeholder').attr('src', $(this).attr('href'));"
+ "$('#popup').fadeIn('fast');});
$('#popup-close').click( function(e) {e.preventDefault(); $('#popup').fadeOut('fast');});});"
+"</script>";有没有人能给我点提示?
发布于 2012-11-22 20:59:42
你应该尝试使用模式对话框,而不是普通的弹出窗口。这将在同一页中打开,位于活动内容的顶部。我相信,在Android上,你试图用弹出窗口做的事情是不可能的。它们将始终在新窗口中打开。
https://stackoverflow.com/questions/13513081
复制相似问题