设置最小和最大缩放级别 [英] Setting min and max zoom levels
问题描述
有使用OSMDroid API - 似乎无法得到变焦控制放大到超过18级使用具有水平12-22本地(SD卡)的自定义地图缓存缩放界面的麻烦。我们可以从12 -18放大,但从未被超越。似乎没有任何办法来设置最小或最大变焦。任何人有哪里此设置定义什么想法?
Having trouble with the zoom interface using OSMDroid API- can not seem to get the zoom control to zoom beyond level 18. Using a local ( SD card ) custom map cache with levels 12-22. We can zoom from 12 -18, but not beyond. There doesn't seem to be any way to set the min or max zoom. Anyone have any ideas on where this setting is defined?
推荐答案
您需要做一个类扩展图形页面,在那里,你可以通过重写getMaxZoomLevel()和getMinZoomLevel(),这样的设置:
You need to make a class extending MapView, there you can set it by overriding the getMaxZoomLevel() and getMinZoomLevel(), like this:
public class CustomMapView extends MapView {
/* constructors */
@Override
public int getMaxZoomLevel() {
return 22;
}
@Override
public int getMinZoomLevel() {
return 12;
}
}
不要忘了更改的MapView呼叫CustomMapView在布局:
don't forget to change the MapView call to CustomMapView in your layout:
<com.yourpackage.CustomMapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
和活动:
private CustomMapView mMapView;
.
.
.
mMapView = (CustomMapView) findViewById(R.id.mapview);
这篇关于设置最小和最大缩放级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!