问题描述
我想在WebView
内加载HTML <IFRAME>
,但是我不知道为什么,它不能这样做.
I want to load an HTML <IFRAME>
inside an WebView
, but I don't know why, it is not able to do so.
我正在使用以下代码加载<IFRAME>
I am using following code to load <IFRAME>
webView.loadData("<iframe src=\"http://www.google.com\"></iframe>", "text/html",
"utf-8");
这就是我尝试过的.
WebSettings webViewSettings = webView.getSettings();
webViewSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webViewSettings.setJavaScriptEnabled(true);
webViewSettings.setPluginsEnabled(true);
webViewSettings.setBuiltInZoomControls(true);
webViewSettings.setPluginState(PluginState.ON);
我提到了互联网许可:
<uses-permission android:name="android.permission.INTERNET" />
我还尝试将WebViewClient
设置为shouldOverrideUrlLoading
总是返回false.
I have also tried settings the WebViewClient
with shouldOverrideUrlLoading
always returning false.
但是它不起作用.
我已经在其他网站(即google.com以外的其他网站)上尝试过此操作.
I have tried this with diffrent sites, i.e. sites other than, google.com.
我正在运行ICS 4.0.3的Samsung Nexus S上对此进行测试
I am testing this on, Samsung Nexus S running ICS 4.0.3
推荐答案
这是它的工作方式.
我注意到原木猫把我扔了
I noticed Log cat was throwing me
要解决此问题,我必须在清单的<application>
标签中添加android:hardwareAccelerated="true"
.
To fix this, I had to add android:hardwareAccelerated="true"
in <application>
tag of Manifest.
我在ICS上遇到了这个问题,发现在Honeycomb设备之后也会出现同样的问题.
I was experiencing this on ICS and its found that the same issue will occur post Honeycomb devices.
希望这会帮助一些人.
这篇关于具有IFRAME android的WebView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!