Android 如何将OnMapReadyCallback设置为我的MapView实例?
我的布局中提供了一个Google Map APIAndroid 如何将OnMapReadyCallback设置为我的MapView实例?,android,google-maps,Android,Google Maps,我的布局中提供了一个Google Map APIMapView: <com.google.android.gms.maps.MapView xmlns:map="http://schemas.android.com/apk/res-auto" android:id="@+id/map_view" ... /> 正如您在上面看到的,我已经覆盖了onMapReady(GoogleMap-GoogleMap),因为我正在实现OnMapReadyCallback接口
MapView
:
<com.google.android.gms.maps.MapView xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="@+id/map_view"
...
/>
正如您在上面看到的,我已经覆盖了onMapReady(GoogleMap-GoogleMap)
,因为我正在实现OnMapReadyCallback
接口
但是,如何将mMapView
的侦听器设置为侦听map ready事件
我尝试了mMapView.setOnMapReadyCallback(this)
,但在MapView
中没有这样的方法可以使用
getMapAsync(OnMapReadyCallback callback)
就你而言
mMapView.getMapAsync(this);
您可以找到文档
mMapView.getMapAsync(this);