android:hint - Display Hint Text in EditText when text is empty, in XML

How to Display Hint Text in EditText when text is empty

Hint text displays when the text is empty. 
* This would be the same in a TextView.

added in API Level 1.


1. Add an EditText to your activity. 

2. In the main.xml file, add the code below.

    <EditText
....         android:hint = "This is a hint. Type name here." />

3. Remove the android:text line, or the android:hint will not display.

4. Compile and run!