"android: dropDownAnchor" does not work on Android Nougat (API 24)

I created a simple AutoCompleteTextView as follows:

<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 drop-down list should be below the autocompletetextview object and view, called dropdownDivider. It should not overlap autocompletetextview. This has been achieved using the property android:dropDownAnchor. This works great on API versions less than 23.

However, in API 24 (Android Nougat), the drop-down list overlaps the autocompletetextview and occupies the entire screen.

What I tried:

  • Replaced <AutoCompleteTextView/>by <android.support.v7.widget.AppCompatAutoCompleteTextView/>, but it did not help.
  • I tried this , this , this and a few more answers, but nothing solved the problem.

Any ideas?

+4
1

, , . autoCompleteTextView.setDropDownHeight(ViewGroup.LayoutParams.WRAP_CONTENT);

+1

Source: https://habr.com/ru/post/1657267/


All Articles