saiket
saiket

Reputation: 3063

How to add watermark in android widget EditText?

Please provide the implementation of watermark text in EditText widget of android,even after Googling it, but cannot find proper solution!

Upvotes: 20

Views: 14147

Answers (2)

Mark Allison
Mark Allison

Reputation: 21909

If by "watermark text" you mean the text which appears in the field when it is empty, then use the attribute android:hint="My Text" in the layout or programmatically call setHint( "My Text" ) on your EditText object.

Upvotes: 39

JOVI INTERNATIONAL
JOVI INTERNATIONAL

Reputation: 23

You can add a layout make its height and width fill_parent and make background transparent and add a TextView as a water-mark in this layout.

I hope it can work.

Upvotes: 0

Related Questions