Search code examples
androidautocompletetextview

How to set the hint of autocomplete textview in android


Hi I want to add the AutoCompleteTextview in demo project where I am looking to set the hint as like we can do in EditText.

I know this is possible in EditText using hint property but I don't know how this can be done in AutoCompleteTextiview.

Thanks in advance.


Solution

  • You can set this in the xml file using

    android:hint="yourHint"
    

    like so.

    <AutoCompleteTextView
            android:id="@+id/autoCompleteTextView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignRight="@+id/passwordEntry"
            android:ems="10"
            android:text=""
            android:hint="Test" />