gpt4 book ai didi

android - HighCharts 不会在 Android +4.x 的 Android webview 中加载

转载 作者:行者123 更新时间:2023-11-30 03:32:38 24 4
gpt4 key购买 nike

我无法让 HighCharts 在 Android Webview 中呈现。这是在 Android 4.0+ 上

下面是我的html代码

<html lang="en" >
<head>
<meta charset="utf-8" />
<meta name="author" content="Script Tutorials" />
<title>How to create active charts using Highcharts | Script Tutorials</title>

<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>

</head>
<body>
<div id="chart_1" class="chart"></div>
<script type='text/javascript'>
$(document).ready(function() {

// First chart initialization
var chart1 = new Highcharts.Chart({
chart: {
renderTo: 'chart_1',
type: 'area',
height: 350,
},
title: {
text: 'Tools developers plans to use to make html5 games (in %)'
},
xAxis: {
categories: ['Processing.js', 'Impact.js', 'Other', 'Ease.js', 'Box2D.js', 'WebGL', 'DOM', 'CSS', 'Canvas', 'Javascript']
},
yAxis: {
title: {
text: 'Interviewed'
}
},
series: [{
name: 'Dev #1',
data: [5, 10, 20, 22, 25, 28, 30, 40, 80, 90]
}, {
name: 'Dev #2',
data: [15, 15, 18, 40, 30, 25, 60, 60, 80, 70]
}, {
name: 'Dev #3',
data: [1, 3, 6, 0, 50, 25, 50, 60, 30, 100]
}]
});

});</script>
</body>
</html>

我从 Assets 目录中读取 html 文件,使用 bufferedreader 将其转换为字符串,然后使用

将其加载到 webview 中
webview.loaddata(customHtml, "text/html", "UTF-8");

最佳答案

您是否在您的 WebView 中启用了 Javascript?如果没有,只需在您的 onCreate 方法中添加这一行:

webview.getSettings().setJavaScriptEnabled(true);

“ WebView ”在哪里:

WebView webview = (WebView)findViewById(R.id.my_webview);

关于android - HighCharts 不会在 Android +4.x 的 Android webview 中加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17180491/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com