开发者

TextView to display hint before text entered

How do I put text into开发者_JS百科 empty TextView so it goes away when user starts typing? Just like here in StackOverflow under "Tags" field.

Same approach used in GMail client. That will save me some space - no need to create labels..


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


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜