How to set the hint of autocomplete textview in android

余生长醉 提交于 2019-12-02 22:44:40

问题


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 AutoCompleteTextviews




回答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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!