7

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:

  • Replaced <AutoCompleteTextView/> with <android.support.v7.widget.AppCompatAutoCompleteTextView/> but that didn't help.
  • Tried this, this, this and a few more answers but nothing solved the issue.

Any ideas?

Community
  • 1
  • 1
kds23
  • 296
  • 3
  • 17
  • i'm also having a different behavior with my autocompletetextviews on android 7.0, normally when clicked, the UI would scroll the clicked view to the top of the screen and then drop down below the view, but now it seems the dropdown is just appearing at the top of the view and the UI doesnt scroll itself – buradd May 08 '17 at 20:29

1 Answers1

2

Setting the drop down height programmatically to wrap content fix the issue for me. autoCompleteTextView.setDropDownHeight(ViewGroup.LayoutParams.WRAP_CONTENT);

Yossi Segev
  • 607
  • 5
  • 12