問題描述:TabHost切換Activity,每個activity中都包含一個高德地圖,首次進入第一個顯示的地圖可以使用,切換到第二個時地圖卡死不能操作。
解決辦法:把MapView改成TextureMapView
1.把layout佈局中的MapView改掉
<com.amap.api.maps.MapView
android:id="@+id/activity_map_map"
android:layout_width="match_parent"
android:layout_height="match_parent" />
改成
<com.amap.api.maps.TextureMapView
android:id="@+id/activity_map_map"
android:layout_width="match_parent"
android:layout_height="match_parent" />
2.把代碼中的MapView改掉
MapView mMapView;
改成
TextureMapView mMapView;