Android: 如何更改 SearchView 中最近查询列表的样式?
Android: How do I change the style of recent queries list in a SearchView?
我为我的可搜索配置实施了一个最近的查询内容提供程序并且它有效,但我如何更改列表的样式?
它带有浅色背景的白色文本,我想至少更改文本的颜色。
感谢您的帮助!
使用 AppCompat Lollipop 的 SearchView API 中的 suggestionRowLayout
属性。有关属性的完整列表,请参阅 this post from Android Developers Blog。
<style name="AppTheme" parent="Theme.AppCompat">
<item name="searchViewStyle">@style/AppTheme.SearchView</item>
</style>
<style name="AppTheme.SearchView" parent="@style/Widget.AppCompat.SearchView">
<!-- Layout for query suggestion rows -->
<item name="suggestionRowLayout">@layout/abc_search_dropdown_item_icons_2line</item>
</style>
如果您对 suggestionRowLayout
属性有疑问,您可以尝试解决方案 . Alternatively, you could try to use the old searchView* theme attributes as you can see in this post。
我为我的可搜索配置实施了一个最近的查询内容提供程序并且它有效,但我如何更改列表的样式?
它带有浅色背景的白色文本,我想至少更改文本的颜色。
感谢您的帮助!
使用 AppCompat Lollipop 的 SearchView API 中的 suggestionRowLayout
属性。有关属性的完整列表,请参阅 this post from Android Developers Blog。
<style name="AppTheme" parent="Theme.AppCompat">
<item name="searchViewStyle">@style/AppTheme.SearchView</item>
</style>
<style name="AppTheme.SearchView" parent="@style/Widget.AppCompat.SearchView">
<!-- Layout for query suggestion rows -->
<item name="suggestionRowLayout">@layout/abc_search_dropdown_item_icons_2line</item>
</style>
如果您对 suggestionRowLayout
属性有疑问,您可以尝试解决方案 . Alternatively, you could try to use the old searchView* theme attributes as you can see in this post。