Play-services 15.0

时间:2018-04-17 07:55:43

标签: android google-maps firebase google-play-services

我已更新了从9.0.115.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,还是将其更改为罚款?

1 个答案:

答案 0 :(得分:1)

MapView替换GoogleMap是不可能的,因为它完全不同:基于MapView FrameLayout的视图显示地图和{{ 3}}是与地图相关的所有方法的入口点。所以很好地继续使用MapView