私には2つのアクティビティがあり、それぞれにマップビューがあります。問題は、マップビューがその中心を変更したりズームしたりすると、もう一方も変更されることです。私は、各Mapviewが異なるID(xml内)と異なる名前変数を持っていることに気づきました。しかし、問題は解決しません。
各アクティビティのコードは、多くの関数を実装しているため、ここに投稿するには長すぎます。しかし、私は最も重要な部分を投稿します:
アクティビティA)
mapview_publish = (MapView) findViewById(R.id.mapview_publish);
mapview_publish.setBuiltInZoomControls(true);
mapController = mapview_publish.getController();
mapController.setZoom(16); /
XML A)
<com.google.android.maps.MapView
android:id="@+id/mapview_publish"
android:layout_width="fill_parent"
android:layout_height="87dp"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_marginTop="12dp"
android:apiKey="myapikey"
android:clickable="false" />
アクティビティB)
mapView = (MapView) findViewById(R.id.mapview);
mapview.setBuiltInZoomControls(true);
mapController = mapView.getController();
mapController.setZoom(20);
XML B)
<com.google.android.maps.MapView
android:id="@+id/mapview"
style="@style/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:apiKey="myapikey"
android:background="@color/black"
android:clickable="true" />