我是关于搜索的 Android 开发者文章:http://developer.android.com/guide/topics/search/index.html并且想知道我是否可以将其他 UI 元素添加到 searchable.xml 文件中?这是我想要做的:
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/app_name" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="System:"/>
<Gallery
android:id="@+id/gallery"
android:layout_width="fill_parent"
android:layout_height="52px"
android:padding="8px"
android:unselectedAlpha="0.5"
android:spacing="3px">
</Gallery>
</searchable>
我想提供图库作为指定搜索类别的方式。这可能吗?如果是,我如何以及在何处访问该组件的用户选择?如果不是,我还能如何实现让用户选择更具体地搜索?
最佳答案
I wan to provide the gallery as a way to specify what category to search in. Is this possible?
不是通过标准的 Android 搜索。
If not, how else might I implement giving a choice to the user to search more specifically?
实现两种搜索机制。一个是在您需要时(搜索按钮、菜单选择等)从您的应用程序启动,并根据您的需要显示,包括类别选择。另一个是用于与 Android 的内置搜索集成的 searchable.xml
机制,在这种情况下,您只能使用他们的搜索 UI 并且只能搜索关键字。
关于java - 我可以自定义 Android searchable.xml 布局吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3329934/