如何禁用按钮以打开Google Maps – Google API Android Studio Java

huangapple 未分类评论49阅读模式
英文:

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?

如何禁用按钮以打开Google Maps – Google API Android Studio Java

@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);
    }

}

huangapple
  • 本文由 发表于 2020年4月9日 00:56:45
  • 转载请务必保留本文链接:https://java.coder-hub.com/61105952.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定