gpt4 book ai didi

android - 在微调器对话框中搜索 View

转载 作者:行者123 更新时间:2023-11-29 20:03:54 24 4
gpt4 key购买 nike

我有微调器,我想在微调器中添加搜索 View ,但我该怎么做。我的应用程序像这样在微调器上方显示搜索 View My App shows this

但是我希望它在用户单击微调器时位于微调器内,它显示搜索 View 和这样的项目列表 After clicking spinner it should be like this

我的 fragment .xml

 <SearchView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/searchView"
android:layout_gravity="center_horizontal" />

<Spinner
android:id="@+id/sCity"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:prompt="@string/city"
android:spinnerMode="dialog"
style="@style/spinner_style"
/>

最佳答案

有一个库具有与您正在寻找的功能完全相同的功能。该库称为 SearchableSpinner这与普通的 android 微调器相同,但在点击微调器时,它会打开一个对话框,其中包含搜索 View 和适配器中设置的项目列表。

GIF for the view请点击链接查看与图书馆相关的gif。

关于android - 在微调器对话框中搜索 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35899039/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com