我无法设置 myLocationChange 侦听器。我的代码如下,我试图在 OnMapReady 方法中设置MyLocationChangeListener。
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final GoogleMap mMap) {
googleMap = mMap;
googleMap.setMyLocationEnabled(true);
googleMap.setOnMyLocationChangeListener(this);
}
感谢您的帮助
this
ingoogleMap.setOnMyLocationChangeListener(this);
指的是OnMapReadyCallback
(内部类)。
如果您的外部类实现,LocationListener
您需要指定它:googleMap.setOnMyLocationChangeListener(YourClass.this);
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句