How to change the default hint value of XML fragme

2019-05-28 08:21发布

问题:

Default hint value of the autocomplete widget is Search. How can this value be changed to a different String?

回答1:

Try out the below code:

PlaceAutocompleteFragment places= (PlaceAutocompleteFragment)getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);
EditText etPlace = (EditText)places.getView().findViewById(R.id.place_autocomplete_search_input);
etPlace.setHint("Your Text");

Hope this helps.