Choose Skin

How to Add Placeholder text to EditText in Android.



Manish Kumar
March 3, 2017


Answered by Manish Kumar 

Placeholder is needed to provide hint to user , to make him understand that what value he have to provide in the text box.

In android XML, We can simply add,
 Android:hint="placeholder text"

for example:
 
<EditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:inputType="textPersonName"
        android:ems="10"
        android:layout_marginTop="91dp"
        android:id="@+id/editText"
        android:hint="Enter first number"
        android:layout_alignParentTop="true"
        android:layout_alignLeft="@+id/editText2"
        android:layout_alignStart="@+id/editText2" />


  Refine your Search

Category