【发布时间】:2017-06-14 06:11:53
【问题描述】:
我想从谷歌地图中删除所有默认对象或地点。我希望知道这更容易还是在叠加层上构建更容易。我想要一张谷歌支持的空白地图。我会随时添加我需要的地方或对象,这可能吗? maps.clear() 没有添加任何帮助,我想要一些 onCreate() 方法或 onStart() 方法来删除所有地方并有一张没有地方只有道路和建筑物的空白地图。
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mapReady = true;
Double latitude = location.getLatitude();
Double longitude = location.getLongitude();
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
mMap.setMyLocationEnabled(true);
// Add a marker in Sydney and move the camera
//LatLng sydney = new LatLng(-34, 151);
LatLng currentPosition = new LatLng(latitude,longitude);
mMap.addMarker(new MarkerOptions().position(currentPosition).title("Current Location"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(currentPosition));
mMap.animateCamera(CameraUpdateFactory.zoomTo(15));
mMap.setMapType();
loadNearByPlaces(latitude,longitude);
}
这是我使用的起始代码。如何修改它并让它做我需要的?
【问题讨论】:
标签: android google-maps android-layout google-maps-markers google-maps-android-api-2