当运行引用Google Map API和.js文件的html页面的.apk文件时,不会显示任何内容

时间:2014-02-11 07:28:02

标签: dhtmlx-scheduler

我正在使用DHTMLXSCHEDULER(它是一个支持触摸屏和现成.js代码的插件)。

当我在Android模拟器上运行我的项目时,我得到以下错误,并在模拟器上显示完整的白屏

  

02-11 02:16:21.398:E / Web Console(868):未捕获的ReferenceError:google未定义在file:///android_asset/codebase/dhxscheduler_mobile.js:316   02-11 02:16:21.405:E / cutils-trace(868):打开跟踪文件时出错:没有这样的文件或目录(2)

html代码如下

<!DOCTYPE html>
<html>
<head>
    <meta  name = "viewport" content = "initial-scale = 1.0, maximum-scale = 1.0, user-scalable = no">
    <script src="http://maps.googleapis.com/maps/api/js?sensor=false" type="text/javascript"></script>
    <script src="../../codebase/dhxscheduler_mobile.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="../../codebase/dhxscheduler_mobile.css">

    <title>Custom view: googlemap</title>
    <script type="text/javascript" charset="utf-8">

        /*adding the new view: layout with toolbar and google map*/
        scheduler.config.views.push({
            id:"locationView",
            rows:[
                {
                    view:"toolbar",
                    css:"dhx_topbar",
                    elements:[
                        {
                            view:'button', 
                            inputWidth: 100,
                            css:"cancel",
                            label: scheduler.locale.labels.icon_back,
                            click: "$$('scheduler').$$('views').back()"
                        }
                    ]
                },
                {   view:"googlemap",
                    id:"mymap"
                }
            ]
        });

        /*Enable read-only mode*/
    //  scheduler.config.readonly = true;

        /*the "Location" button in toolbar config*/
        scheduler.config.selected_toolbar = [
            {view:'button', inputWidth:scheduler.xy.icon_back, css:"cancel", id:"back",align:"left",label:scheduler.locale.labels.icon_back},
            {view:'button',  width:100, id:"location",align:"right",label:"Location", click:"showLocation"}, //the new button
            {view:'button',  width:70, id:"edit",align:"right",label:scheduler.locale.labels.icon_edit}
        ];

        /*initial date*/
        scheduler.config.init_date = new Date(2011,5,21);

        function showLocation(){
            /*shows the view of multiview*/
            $$("scheduler").$$("locationView").show();
            /*necessary to resize google map*/
            $$("scheduler").$$("locationView").resize();

            /*map object by view id*/
            var map = $$("scheduler").$$("mymap").map;
            map.setZoom(15);
            /*event data*/
            var eventId = $$("scheduler").getCursor();
            var item = $$("scheduler").item(eventId);
            var y = parseFloat(item.y);
            var x = parseFloat(item.x);
            var details = item.details;
            /*LatLng point*/
            var point = new google.maps.LatLng(x,y);

            map.setCenter(point);
            var marker = new google.maps.Marker({
                 position: point,
                 title: details
            });
            marker.setMap(map); 
        }

        dhx.ready(function(){
            /*initialization*/
            dhx.ui.fullScreen();
            dhx.ui({
                view: "scheduler",
                id: "scheduler"
            });
            /*adding data*/
            var data = [
                {
                    id:1,
                    start_date:"2011-06-21 00:00:00",
                    end_date:"2011-07-05 00:00:00",
                    text:"Wimbledon",
                    details:"Wimbledon June 21, 2011 - July 5, 2011",
                    x:51.439,
                    y:-0.208
                }
            ];
            $$("scheduler").parse(data);
            /*preselects Month view*/
            $$("scheduler").$$("buttons").setValue("month");
        });
    </script>
</head>
<body>
</body>
</html>

问题是Google Map脚本没有在上面的代码中导入。我无法做到这一点,以便在上面的文档中加载Google Map脚本。

可能出现什么问题?

0 个答案:

没有答案