I have created a simple AutoCompleteTextView like this :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<AutoCompleteTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/query"
android:dropDownAnchor="@id/dropdownDivider"
android:dropDownWidth="match_parent"
android:dropDownHeight="match_parent"
android:inputType="text"
android:android:imeOptions="actionSearch"/>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#ccc"
android:id="@+id/dropdownDivider"/>
</LinearLayout>
The dropdown is supposed to come below the autocompletetextview and the view called "dropdownDivider". It is not supposed to overlap the autocompletetextview. This was achieved by using the android:dropDownAnchor
property. This works perfectly in API versions less than 23.
However in API 24 (Android Nougat), the dropdown overlaps the autocompletetextview and occupies full screen.
What I tried:
<AutoCompleteTextView/>
with
<android.support.v7.widget.AppCompatAutoCompleteTextView/>
but that
didn't help.Any ideas?
Setting the drop down height programmatically to wrap content fix the issue for me.
autoCompleteTextView.setDropDownHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
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