DropDownAnchor 在 AutoCompleteTextView 中不起作用

DropDownAnchor not working in AutoCompleteTextView

我的项目中有一个 AutoCompleteTextView。它正在工作,但下拉列表显示在文本视图的顶部而不是底部。我将 dropDownAnchor 设置为文本视图,但它什么也没做。我不知道还有什么办法可以解决它。任何帮助将不胜感激。

<AutoCompleteTextView
        android:id="@+id/tagsTextView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="16dp"
        android:layout_marginEnd="8dp"
        android:backgroundTint="@color/darkGray"
        android:completionThreshold="2"
        android:dropDownAnchor="@+id/tagsTextView"
        android:hint="Enter Tag"
        android:textCursorDrawable="@drawable/autocomplete_cursor_color"
        app:layout_constraintEnd_toStartOf="@id/addButton"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/tagsLayout">

这是它的样子:

请参见下图,其中包含相同提示列表的两个下拉列表。 唯一的区别是我添加了 android:dropDownHeight="180dp"

AutoCompleteTextView

您无法在自动完成文本视图中设置下拉列表的位置。它会占据适合的位置。优先级向下。在你的情况下,向上的高度大于向下的高度 direction.so 如果你想要总是向下那么给出一些像我上面所说的高度小于键盘和输入文本视图之间的 space