【发布时间】:2019-01-24 10:55:53
【问题描述】:
我在安卓中使用地图。这是我的 OnLocationChanged 方法,我的应用程序工作正常,但我正在缩放我的地图,它会在几秒钟后自动缩小……我在我的方法中使用上述 MoveCamera。我在 Android Studio 中使用 MapsActivity 默认值。
public void onLocationChanged(Location location) {
mCurrentLocation = location;
if (mCurrLocationMarker != null) {
mCurrLocationMarker.remove();
//Toast.makeText(context, "Location Not Found.", Toast.LENGTH_SHORT).show();
}
//Place current location marker
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(latLng);
markerOptions.title("Current Position");
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
mCurrLocationMarker = mMap.addMarker(markerOptions);
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 12));
}
【问题讨论】:
-
首先,试着理解你在代码中写了什么
标签: android google-maps dictionary