EditText display hint string

We can set edittext hint by using edittext ‘android:hint’ property.

Edittext hint is used to display a hint about the edittext.

Example: – When we are creating a login window we will create a textview & editext.

Textview is for input (“Enter the username”).

Editext is for output (“androidpeople”).

By using edittext hint we need not create a textview for input. We can provide input text in edittext hint.


    <EditText
   android:id="@+id/autoCompleteTextView1"
   android:layout_height="31dip"
   android:layout_width="fill_parent"
   android:background="@drawable/search_edit_bg"
   android:hint="search keyword"
   android:singleLine="true"
   android:lines="1"
   android:maxLines="1">
    </EditText>

in code

EditText.setHint("search keyword");

By admin-powenko

Dr. Powen Ko is a teacher and CEO on LoopTek LLC, and like to teaching. if you need to class, please let PowenKo know, he will love to service and sharing. LoopTek web site is www.looptek.com

Leave a Reply