我已更新了从9.0.1
到15.0.0
的播放服务,现在我看到不再支持MapView.getMap();
了。
我查了this,我跟着它解决了问题。
public class MapsFragment extends Fragment implements OnMapReadyCallback{
MapView mMapView;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mMapView = (MapView) view.findViewById(R.id.mapView);
mMapView.onCreate(savedInstanceState);
mMapView.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap googleMap) {
}
布局
<com.google.android.gms.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
问题是,我使用MapView
而不是GoogleMap
,所以我刚刚添加了onMapReady()
方法作为接口所需的方法,但我没有做任何事情。
如果我继续在MapView
GoogleMap
,我应该将所有内容视为工作正常,但我应该将MapView
更改为play-services:15.0.0
,还是将其更改为罚款?
答案 0 :(得分:1)
MapView
替换GoogleMap
是不可能的,因为它完全不同:基于MapView
FrameLayout
的视图显示地图和{{ 3}}是与地图相关的所有方法的入口点。所以很好地继续使用MapView
。