如何从Google Places API将PlacePicker的地图类型从简单更改为卫星?

Ham*_*sir 6 java android google-maps google-places-api android-studio

PlacePicker在我的应用程序中使用API,并希望将其地图类型从简单更改为卫星.

PlacePicker是Google提供的API.

这是我使用它的方式:

// Construct an intent for the place picker
                try {
                    PlacePicker.IntentBuilder intentBuilder =
                            new PlacePicker.IntentBuilder();
                    Intent intent = intentBuilder.build(this);
                    // Start the intent by requesting a result,
                    // identified by a request code.
                    startActivityForResult(intent, PLACE_PICKER_REQUEST);

                } catch (GooglePlayServicesRepairableException e) {
                    Snackbar snackbar = Snackbar
                            .make(coordinatorLayout, e.getMessage(), Snackbar.LENGTH_SHORT);
                    snackbar.show();
                    // ...
                } catch (GooglePlayServicesNotAvailableException e) {
                    Snackbar snackbar = Snackbar
                            .make(coordinatorLayout, e.getMessage(), Snackbar.LENGTH_SHORT);
                    snackbar.show();
                    // ...
                }
Run Code Online (Sandbox Code Playgroud)

然后在onActivityResult():

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == PLACE_PICKER_REQUEST
                && resultCode == Activity.RESULT_OK) {

            // The user has selected a place. Extract the name and address.
            final Place place = PlacePicker.getPlace(data, this);

            final CharSequence name = place.getName();
            final CharSequence address = place.getAddress();
            LatLng latLng = place.getLatLng();
            final double lat = latLng.latitude;
            final double lng = latLng.longitude;
            String attributions = PlacePicker.getAttributions(data);
            if (attributions == null) {
                attributions = "";
            }

//            mViewName.setText(name);
//            mViewAddress.setText(address);
//            mViewAttributions.setText(Html.fromHtml(attributions));

        } else {
            super.onActivityResult(requestCode, resultCode, data);
        }
    }
Run Code Online (Sandbox Code Playgroud)

它只显示简单的地图类型.我想显示卫星类型地图.

请让我知道怎么做?

And*_*ewR 2

目前无法在地点选取器中更改地图类型。您可以在 Place API 的公共问题跟踪器上添加功能请求。

  • 完成 https://code.google.com/p/gmaps-api-issues/issues/detail?id=10940&thanks=10940&ts=1480037051 :) (2认同)