android – 无法设置null的属性’overflow’

webView.getSettings().setJavaScriptEnabled(true);

webView加载此HTML代码:

<html>
    <head>
        <script type='text/javascript' src='https://www.google.com/jsapi'></script>
        <script type='text/javascript'>
            google.load('visualization', '1', {packages: ['corechart']});
            google.setOnLoadCallback(drawChart);
            function drawChart() {
                var data = google.visualization.arrayToDataTable([
                    ['Year', 'Sales', 'Expenses'],
                    ['2004', 1000, 400],
                    ['2005', 1170, 460],
                    ['2006', 660, 1120],
                    ['2007', 1030, 540]
                ]);
                var options = {title: 'Company Performance'};
                var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
                chart.draw(data, options);
            }
        </script>
    </head>
    <body>
        <div id='chart_div' style='width: 900px; height: 500px;'></div>
    </body>
</html>

这是来自Google的示例Visualization: Line Chart的代码

webView显示文本无法设置null的属性’overflow’
如何解决?

最佳答案 你指的错误是从javascript抛出的,我猜(否则应用程序会崩溃)?

您正在尝试使用哪些Android操作系统版本?如果它是2.x,除非你的Google图表使用后备渲染器,例如CanVg(我知道highcharts使用canvg成功),因此你不会走得太远,因为WebView不知道svg.

点赞