如何在操作栏外的 SearchView 中添加标签?

How to add label in a SearchView outside of action bar?

Screenshot

如何在 SearchView 中添加标签?起初我使用 ImageButtonText 组合来实现我想要的显示。 (参见屏幕截图,第 2 行)我切换到 SearchView,我想知道如何修改它的外观,使其与 ImageButton/Text 组合相同?

向搜索视图添加提示。看到这个 documentation.

Create a Searchable Configuration

A searchable configuration defines how the SearchView behaves and is defined in a res/xml/searchable.xml file. At a minimum, a searchable configuration must contain an android:label attribute that has the same value as the android:label attribute of the or element in your Android manifest. However, we also recommend adding an android:hint attribute to give the user an idea of what to enter into the search box:

<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
        android:label="@string/app_name"
        android:hint="@string/search_hint" />