【问题标题】:MapView.getMap() is not supported in play-services 15.0播放服务 15.0 不支持 MapView.getMap()
【发布时间】:2018-09-27 02:24:31
【问题描述】:

我已将播放服务从 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,还是可以,如果我继续在play-services:15.0.0 中使用MapView 的话

【问题讨论】:

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


    【解决方案1】:

    没有必要(也不可能)将MapView 替换为GoogleMap,因为它完全不同:MapView FrameLayout - 显示地图的基于视图,GoogleMap 是所有方法的入口点与地图有关。所以可以继续使用MapView

    【讨论】:

      猜你喜欢
      • 2021-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-20
      • 1970-01-01
      • 1970-01-01
      • 2012-09-15
      相关资源
      最近更新 更多