问题
I am building an application, where the user has to select a Place he wants.
For that, I am using the PlacePicker dialog, as the Google Places API for Android is teaching in the API reference site.
However, when the user click the button and open the Place Picker Dialog, it does not have any button where the user can type the name of the place he wants to select. So, the user will have to select a place just dragging on the map; this is horrible for the user, specially if he wants to choose a specific location far from his location or he doesn't know where is the place on the map.
So, I've tried searching on Google and foruns on the internet and I didn't find anything about how to set the dialog to appear the search button.
Thank you! ;)
回答1:
Unfortunately the Place Picker does not support what you are asking for.
回答2:
From what I can see search is currently not supported in the PlacePicker API. You can look at: PlacePicker.IntentBuilder and PlacePicker @Ferran Negre: Yes, I also saw that Hangouts (version 4.0.100406486) seems to use the PlacePicker with search. I actually logged it to make sure and they do use the PlacePicker activity. SO either they copied the PlacePicker code into Hangouts and modified it (they are Google and should have access) OR there is a hidden API for showing search that for some reason has not yet been released. Even if such a hidden API exists though it would be bad practice to try to use it.
回答3:
It looks like that they have listened to us and they already support this feature!
We have also added the autocomplete functionality to the place picker—a UI widget that helps users communicate their current location, such as a place, address or location on a map.
http://googlegeodevelopers.blogspot.com/2015/12/autocomplete-widget-and-updated-place.html
回答4:
Place picker currently not supporting option to search ,but you can use android-place-picker library by this lib you can achieve this functionality + you can display recent searched locations also.And hope Google will soon add this feature to Place Picker.till that time you can use this. :)
来源:https://stackoverflow.com/questions/29396368/google-places-api-for-android-placepikcer-without-search-option