How to change the default hint value of XML fragment element in Android layout

主宰稳场 提交于 2019-12-22 19:07:08

问题


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.



来源:https://stackoverflow.com/questions/43505759/how-to-change-the-default-hint-value-of-xml-fragment-element-in-android-layout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!