【问题标题】:Set marker with place name in google maps在谷歌地图中设置带有地名的标记
【发布时间】:2016-05-25 17:27:01
【问题描述】:

我正在使用

获取谷歌地图的地名
  Place place = PlaceAutocomplete.getPlace(MainActivity.this, data);
  Logger.e("The ", "Place: " + place.getName());

现在我想在这个地名上设置标记。我怎样才能做到这一点?

【问题讨论】:

标签: android google-maps google-maps-markers


【解决方案1】:

首先尝试使用Geocoder从地名中获取纬度和经度,然后尝试使用以下代码在地图上显示标记。

 GoogleMap map;
    map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
    map.addMarker(new MarkerOptions()
            .position(new LatLng(placelatitude, placeLongitude))
            .title("Place Name"));

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-13
    • 1970-01-01
    • 2022-12-23
    • 1970-01-01
    相关资源
    最近更新 更多