Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AutoCompleteTextView float hint

I've tried a lot, but can't make work an AutoCompleteTextView float hint using the TextInputLayout from support.

It's possible or I need to use an external library?

like image 996
Marcelo Baccelli Avatar asked Aug 13 '15 12:08

Marcelo Baccelli


People also ask

How do I get rid of floating hint in TextInputLayout?

There may be three ways to go about achieving this: 1 Set android:hint on TextInputLayout to a space _ character, and keep android:hint="This is my cool hint" set on the EditText . By setting android:hint=" " , if (TextUtils. isEmpty(mHint)) evaluates to false , and the EditText retains its hint.

What does Android completion hint attribute in AutoCompleteTextView does?

android:completionHintView. Defines the hint view displayed in the drop down menu. android:completionThreshold. Defines the number of characters that the user must type before completion suggestions are displayed in a drop down menu.

How do you get the ID of the selected item of the AutoCompleteTextView in Android?

Just call your adapter. getItem(position) and you will get the output you want. For example skillLevelAdapter. getItem(position).


1 Answers

No .

design library itself is enough

include like this

<android.support.design.widget.TextInputLayout
    android:id="@+id/til_id"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="125dp"
    >

    <AutoCompleteTextView
        android:id="@+id/auto_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Id"
        android:singleLine="true"/>
</android.support.design.widget.TextInputLayout>
like image 95
N J Avatar answered Sep 19 '22 22:09

N J