1

我的代码是这样的。它工作正常。
如何设置纬度经度PlacePicker.IntentBuilder以便我可以在地图上看到位置

   try {
            PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();                
            Intent intent = builder.build(MainActivity.this);
            startActivityForResult(intent, PLACE_PICKER_REQUEST_CODE);
        } catch (GooglePlayServicesRepairableException
                | GooglePlayServicesNotAvailableException e) {
            e.printStackTrace();
        }
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == PLACE_PICKER_REQUEST_CODE) {
            final Place place = PlacePicker.getPlace(this, data);
            final CharSequence name = place.getName();
            final CharSequence address = place.getAddress();
            Khet_Location = address.toString();
            Place_Name = name + "," + address;
            String attributions = (String) place.getAttributions();
            if (attributions == null) {
                attributions = "";
            }
            current_location_id.setVisibility(View.VISIBLE);
            current_location_id.setText(Place_Name);
            Double latitude = place.getLatLng().latitude;
            Double longitude = place.getLatLng().longitude;
            Address_lat = String.valueOf(latitude);
            Address_long = String.valueOf(longitude);
        }else
            super.onActivityResult(requestCode, resultCode, data);
     }

请帮帮我。

4

1 回答 1

1

你的意思是集中所有的地方选择器,我不太明白你的问题......

但检查这个...

setLatLngBounds(LatLngBounds latLngBounds)

例子

for i to n{
   array coords
   add in LatLngBounds
}
placepicker.setLatLngBounds(latLngBounds)
于 2017-08-25T16:32:59.340 回答