is there a way to set the text hint displayed inside of an android edittext with java? I would like for my app to be able to display different things in the edittext at different times, thanks in advance
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How can I create this custom Bottom Navigation on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
Call
setHint()
on theEditText
.You can try following,
Throw an
android:hint="hint text"
into yourEditText
xml tag.If you are using simple
Editext
withoutTextInputLayout
:If you are using
Editext
withinTextInputLayout
then you need to change property ofTextInputLayout
notEdittext
:if you are using actionbarsherlock searchview, this is the best way to set string dynamically
for editText.hint you must delete name of your edit.Text from activity_main.xml then set in the MainActivity in java or activity_main.xml because text is preferred to hint.