我已经创建了一个简单的AutoCompleteTextView,代码如下:
下拉菜单应该位于自动完成文本视图和名为“dropdownDivider”的视图下方。它不应重叠在自动完成文本视图上。这是通过使用android:dropDownAnchor属性实现的。在API 23以下的版本中,这个方法完美地运行。
然而,在API 24(Android Nougat)中,下拉菜单会重叠在自动完成文本视图上,并占据整个屏幕。
我尝试过: - 用替换,但没有帮助。 - 尝试了一些答案,如this、this、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>
下拉菜单应该位于自动完成文本视图和名为“dropdownDivider”的视图下方。它不应重叠在自动完成文本视图上。这是通过使用android:dropDownAnchor属性实现的。在API 23以下的版本中,这个方法完美地运行。
然而,在API 24(Android Nougat)中,下拉菜单会重叠在自动完成文本视图上,并占据整个屏幕。
我尝试过: - 用替换,但没有帮助。 - 尝试了一些答案,如this、this、this等等,但都无法解决问题。
有什么想法吗?