Issue
I implemented a MapActivity with Pins on it, following HelloMapView Tutorial and many StackOverflow resources.
For the purpose of my app, I would like to limit the zoom levels with a minimum and a maximum. In fact I would like to avoid using android:clickable="true" on my MapView.
I could not find how do achieve that.
- Is it possible?
- Does someone knows how to do that?
- Is there a built-in function to override like
onZoomChanged()that I did not see?
AndroidManifest.xml
<uses-sdk
android:maxSdkVersion="16"
android:minSdkVersion="7"
android:targetSdkVersion="15" />
MyMapActivity.java
// Here is my MapView
mMapView = (MapView) findViewById(R.id.game_map);
mMapView.setBuiltInZoomControls(false);
mMapView.setSatellite(true);
mMapController = mMapView.getController();
mMapController.setZoom(CONST_MAP_ZOOM);
mMapController.setCenter(new GeoPoint(48856700, 2351000));
mMapController.animateTo(new GeoPoint(48856700, 2351000));
But when I use fingers, I can zoom out until I see the whole planet.
What I would like would be to limit the zoom levels.
Solution
I found a way out.
I disable multi-touche on the MapView:
<com.google.android.maps.MapView
android:id="@+id/game_map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:apiKey="@string/google_maps_api_key"
android:clickable="true" />
Then I hide zoom controls:
mMapView = (MapView) findViewById(R.id.game_map);
mMapView.setBuiltInZoomControls(false);
Then I implement my own zoom controls.
Answered By - shkschneider
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.