My AutoCompleteTextView doesn't work when I enter first character in textbox but starts showing dropdown when I enter second character. What could be the reason?
<AutoCompleteTextView
android:id="@+id/autocomplete_name"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="7"
android:background="@drawable/edittextback"
android:ems="10"
android:textSize="15sp"
android:hint="@string/codehint"
android:textColorHint="@color/hintgrey"
android:dropDownWidth="fill_parent"
android:paddingRight="30dp"
android:paddingLeft="10dp"
android:singleLine="true"
android:ellipsize="end"
/>
You will need to set the completionThreshold
property of your autoCompleteView
to 1.
<AutoCompleteTextView
android:id="@+id/someID"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:completionThreshold="1" />
Or for doing it dynamically through code use
mAutoCompleteTextView.setThreshold(1)
use i java code
autoComplete.setThreshold(1);
or in xml
android:completionThreshold="1"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With