|
发表于 2017-10-31 18:09:15
|
显示全部楼层
这个问题,可以参考百度地图插件的原生实现。里面有原生调用js的代码。
mBaiduMap.setOnMapClickListener(new BaiduMap.OnMapClickListener() {
/**
* 单击地图
*/
public void onMapClick(LatLng point) {
try {
touchType = "单击地图";
currentPt = point;
updateMapState();
// baiduMap.prototype.eventOccur
// {action:String,lat:Num,lon:Num,zoom:Num,overlook:Num,rotate:Num}
JSONObject js = new JSONObject();
js.put("action", "click");
js.put("lat", point.latitude);
js.put("lon", point.longitude);
js.put("zoom", mBaiduMap.getMapStatus().zoom);
js.put("overlook", mBaiduMap.getMapStatus().overlook);
js.put("rotate", mBaiduMap.getMapStatus().rotate);
callJS("navigator.baiduMap.base.eventOccur(" + js + ")");
} catch (JSONException e) {
e.printStackTrace();
}
} |
|