0

我想用谷歌地图放大到一个点,但我想使用 android sdk 8 而不是 11

<fragment
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="0dip"
    android:layout_weight="90"
    class="com.google.android.gms.maps.SupportMapFragment" />

mapView = (MapView) findViewById(R.id.map);
mapView.setBuiltInZoomControls(true);
mc = mapView.getController();

但我有错误

java.lang.ClassCastException: android.support.v4.app.NoSaveStateFrameLayout cannot be cast to com.google.android.maps.MapView

所以我想用 sdk8 放大到一个点

谢谢

4

2 回答 2

1

我认为您需要调用 getMap(),而不是 findViewById。该模式记录在 Maps API v2 for Android 指南的Map Objects中。

于 2013-03-25T18:07:28.567 回答
0

试试这个

GoogleMap map = getMap();

请注意,GoogleMap 类来自“com.google.android.gms.maps.GoogleMap”包。

于 2013-10-03T12:51:29.873 回答