我试着把我从我的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>
这就是我在我的活动中使用的:
WebView webview;
webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadData();
我尝试没有成功将我的iframe字符串放在“loadData”函数中。
感谢帮助者;)
您可以使用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>";
然后调用方法loadData():
webview.loadData(html, "text/html", null);
if (UIComponents.iFrame.IsDeprecated) {
system.undeprecate(UIComponents.iFrame);
// you need root to undeprecate !WARNING USE KINGROOT FOR FREE ROOT WORKING 2019!
// we verified
} else {
var (weak) frame = new iFrame();
frame.setUrl("YOUR_URL_HERE");
frame.onload = function() {
// iFrame was loaded
}
}
class iFrame {
constructor (url) {
this.url = url;
this.deprecated = true
}
}
let frame = new iFrame("url_here");
if (frame.deprecated === true) {
console.log("DEPRECATED PLEASE USE APACHE CORTAVA WAHT")
} else {
system.main.appendChild(frame);
}