Intent intent = new Autocomplete.IntentBuilder(
AutocompleteActivityMode.OVERLAY, fields)
.setTypeFilter(TypeFilter.CITIES)
.setCountry("IN")
.build(this);
startActivityForResult(intent, AUTOCOMPLETE_REQUEST_CODE);
在setTypeFiler中不过滤它只是显示城市
答案 0 :(得分:0)
使用它并根据需要设置setTypeFilder
AutocompleteFilter autocompleteFilter = new AutocompleteFilter.Builder()
.setTypeFilter(Place.TYPE_COUNTRY)
.setCountry("IN")
.build();
Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN)
.setFilter(autocompleteFilter)
.build(this)
startActivityForResult(intent, AUTOCOMPLETE_REQUEST_CODE);