问题
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.
回答1:
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" />
回答2:
It's attr_android:completionHint for AutoCompleteTextview
s
回答3:
You can use the same property as you would with an EditText element.
android:hint="Password"
来源:https://stackoverflow.com/questions/26932907/how-to-set-the-hint-of-autocomplete-textview-in-android