安卓(图形页面):如何设置4英里的MapView缩放级别? [英] Android (MapView): How to set Zoom level of 4 miles in the mapview?

查看:238
本文介绍了安卓(图形页面):如何设置4英里的MapView缩放级别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有个纬度和经度(的GeoPoint),这是地图的中心。 我想设置的4英里距离的经度和纬度,我有缩放级别。

I have a latitude and longitude(GeoPoint) which is the center of map. I want to set zoom level of 4miles distance from latitude and longitude that I have.

在此先感谢,

推荐答案

您可以使用setzoom() - 函数来做到这一点。在code以下可以这个例子

You can use the setzoom()-function to do so. The code below can be found in this example.

mc = mapView.getController();
String coordinates[] = {"1.352566007", "103.78921587"};
double lat = Double.parseDouble(coordinates[0]);
double lng = Double.parseDouble(coordinates[1]);

p = new GeoPoint(
    (int) (lat * 1E6), 
    (int) (lng * 1E6));

mc.animateTo(p);
mc.setZoom(17); 

这篇关于安卓(图形页面):如何设置4英里的MapView缩放级别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆