TextView to display hint before text entered

后端 未结 2 1028
面向向阳花
面向向阳花 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: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).

提交回复
热议问题