【发布时间】: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