Android add placeholder text to EditText

后端 未结 8 837
感动是毒
感动是毒 2020-12-02 04:34

How can I add a placeholder text to EditText in the class that isn\'t in the XML?

I have the following EditText in my code which will be sh

8条回答
  •  自闭症患者
    2020-12-02 04:59

    Ah, ok. What you're looking for is setHint(int). Simply pass in a resource id of a string from your xml and you're good to go.

    enter image description here

    EDIT

    And in XML, it's simply android:hint="someText"

提交回复
热议问题