【问题标题】:AutoCompleteTextView shows dropdown off screenAutoCompleteTextView 显示下拉菜单
【发布时间】:2019-10-22 17:51:31
【问题描述】:

我已经实现了AutoCompleteTextView,但在少数设备(小米和三星)中,当 TextView 位于屏幕底部时,它不会显示选项。

注意:字段是动态的,因此我无法选择将视图从底部移到上方

图片 3:check the correct here (Motorola device)

我试过了:

  1. AutocompleteTextView suggestion list goes up
  2. Android : autocompletetextview, suggestion list displays above the textview?
  3. AppCompatAutoCompleteTextView
  4. 在 Android Manifest 中添加不同的 windowSoftInputMode

还有很多其他在 StackOverflow 上的东西,但没有任何效果

我的代码

     <AutoCompleteTextView
                    android:id="@+id/txt_drop_down"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:minHeight="@dimen/_40dp"
                    android:layout_weight="1"
                    android:background="@drawable/et_bottom_border"
                    android:completionThreshold="1"
                    android:gravity="center_vertical|start"
                    android:padding="@dimen/_10dp"
                    tools:text="Hello"
                    android:dropDownHeight="wrap_content"
                    tools:textColor="@android:color/black"
                    android:textAlignment="viewStart"
                    android:textColor="@android:color/white"
                    android:textSize="@dimen/_16sp"
                    tools:textSize="35sp" />

【问题讨论】:

    标签: android


    【解决方案1】:

    将 xml 中的 android:dropDownHeight 设置为固定数字(例如 150dp)。然后,您将在那里有带有滚动条的固定下拉菜单。还将android:layout_height 设置为固定大小。

    【讨论】:

    • 我试过了。它没有用。它是特定于设备的。谢谢:)
    • 你也可以使用 android:dropDownAnchor, android:dropDownHorizo​​ntalOffset, android:dropDownVerticalOffset 和其他一些属性。 (如果有特定的设备,那么可能没有针对所有情况的通用修复,例如三星的相机方向,它需要单独的“if”:-()
    猜你喜欢
    • 1970-01-01
    • 2023-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多