英文:
How can I disable buttons to open google Maps - Google API android studio java
问题
@Override
public void onMapReady(GoogleMap googleMap) {
map = googleMap;
// 启用右下角的缩放按钮
map.getUiSettings().setZoomControlsEnabled(true);
Bundle extras = getIntent().getExtras();
if (extras != null) {
destinationPassed = extras.getString("key");
}
// 启用右上角的定位按钮
map.setMyLocationEnabled(true);
LatLng place = getLatLngFromAddress(destinationPassed);
float zoom = 14.5f;
if(place != null) {
map.moveCamera(CameraUpdateFactory.newLatLngZoom(place, zoom));
googleMap.addMarker(new MarkerOptions().position(place)
.title(destinationPassed));
Toast.makeText(Map.this,"点击标记选择行程",Toast.LENGTH_LONG);
} else{
LatLng current = new LatLng(currentLat,currentLong);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(current, zoom));
Toast.makeText(Map.this,"无法找到位置",Toast.LENGTH_LONG);
}
}
英文:
I am developing an app that uses Google Maps API and I was wondering how to disable/hide the google maps icons that appear on the right bottom corner when the user clicks on a marker?
@Override
public void onMapReady(GoogleMap googleMap) {
map = googleMap;
//enable the zoom in and out buttons bottom right
map.getUiSettings().setZoomControlsEnabled(true);
Bundle extras = getIntent().getExtras();
if (extras != null) {
destinationPassed = extras.getString("key");
}
//enables the set view to current location top right
map.setMyLocationEnabled(true);
LatLng place = getLatLngFromAddress(destinationPassed);
float zoom = 14.5f;
if(place != null) {
map.moveCamera(CameraUpdateFactory.newLatLngZoom(place, zoom));
googleMap.addMarker(new MarkerOptions().position(place)
.title(destinationPassed));
Toast.makeText(Map.this,"Click on the Marker to select the trip",Toast.LENGTH_LONG);
} else{
LatLng current = new LatLng(currentLat,currentLong);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(current, zoom));
Toast.makeText(Map.this,"Location Could Not be Found",Toast.LENGTH_LONG);
}
}
专注分享java语言的经验与见解,让所有开发者获益!
评论