TextView to display hint before text entered

后端 未结 2 1029
面向向阳花
面向向阳花 2021-01-12 09:44

How do I put text into empty TextView so it goes away when user starts typing? Just like here in StackOverflow under \"Tags\" field.

Same approach used in GMail clie

相关标签:
2条回答
  • 2021-01-12 09:53

    Throw an android:hint="hint text" into your EditText xml tag.

    0 讨论(0)
  • 2021-01-12 09:54

    As haphazard said or programatically you can use...

    setHint(CharSequence hint) or setHint(int resId).

    The equivalent to the resource id in xml would be android:hint="@string/hint_text" (for example).

    0 讨论(0)
提交回复
热议问题