Yos*_*ssi 14 iframe android webview
我试着把我从我的thingpeak帐户中获取的iframe图表.
这是我需要放的字符串(我从thingspeak中获取):
<iframe width="450" height="260" style="border: 1px solid #cccccc;" src="http://api.thingspeak.com/channels/31592/charts/1?width=450&height=260&results=60&dynamic=true" ></iframe>
Run Code Online (Sandbox Code Playgroud)
这就是我在我的活动中使用的:
WebView webview;
webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadData();
Run Code Online (Sandbox Code Playgroud)
我尝试没有成功将我的iframe字符串放在"loadData"函数中.
感谢帮助者;)
Arl*_*ind 27
您可以使用html 创建一个String:
String html = "<iframe width=\"450\" height=\"260\" style=\"border: 1px solid #cccccc;\" src=\"http://api.thingspeak.com/channels/31592/charts/1?width=450&height=260&results=60&dynamic=true\" ></iframe>";
Run Code Online (Sandbox Code Playgroud)
然后调用方法loadData():
webview.loadData(html, "text/html", null);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
25894 次 |
| 最近记录: |