Android add placeholder text to EditText
In your Activity
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="@null"
android:hint="Text Example"
android:padding="5dp"
android:singleLine="true"
android:id="@+id/name"
android:textColor="@color/magenta"/>
Ah, ok. What you're looking for is setHint(int)
. Simply pass in a resource id of a string from your xml and you're good to go.
EDIT
And in XML, it's simply android:hint="someText"
android:hint="text"
provides an info for user that what he need to fill in particular editText
for example :- i have two edittext one for numeric value and other for string value . we can set a hint for user so he can understand that what value he needs to give
android:hint="Please enter phone number"
android:hint="Enter name"
after running app these two edittext will show the entered hint ,after click on edit text it goes and user can enter what he want (see luxurymode image)