gpt4 book ai didi

android - 如何更改我对 map Activity 的第一 View

转载 作者:行者123 更新时间:2023-11-29 18:20:05 35 4
gpt4 key购买 nike

我的应用程序中有一个 map Activity 。当用户第一次启动 map Activity 时, map 会显示欧洲的概况。我想,当用户首先启动 map Activity 以指向希腊而不是希腊时欧洲洞..这可能吗..?谢谢

最佳答案

您可以使用 MapController 来做到这一点:

MapView map = (MapView) findViewById(R.id.mapview);

GeoPoint center = new GeoPoint(myLatitude, myLongitude);

MapController controller = map.getController();
controller.setCenter(center);
controller.setZoom(ZOOM_LEVEL_DEFAULT);

或者如果你想计算适合某个经度/纬度跨度的缩放:

int latitudeSpan = latitude1 - latitude2;
int longitudeSpan = longitude1 - longitude2;
controller.zoomToSpan(latitudeSpan, longitudeSpan);

关于android - 如何更改我对 map Activity 的第一 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5991565/

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