风格化的搜索查看小工具使用支持库V21 [英] Styling the SearchView Widget using support library v21

查看:215
本文介绍了风格化的搜索查看小工具使用支持库V21的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用的样式新AppCompat V21的搜索查看窗口小部件,但我面临的一些问题。不管是什么布局我的suggestionRowLayout属性设置,它什么都没有。该搜索查看的建议下拉列表中仍然以同样的方式。

I'm trying to style the SearchView widget using the new AppCompat v21, but I'm facing some problems. No matter what layout I set on "suggestionRowLayout" attribute, it does nothing at all. The suggestion dropdown list of the SearchView remains the same way.

这是我遇到的其他问题是当强调色是同色的原色,在搜索查看,无法分辨哪里是尖。你知道我怎么可以改变口音的颜色在搜索查看,只在那里适用?我发现,播放音乐有同样的问题。

Other problem that I'm having is when the "accent color" is the same color as the "primary color", in the searchview is impossible to distinguish where is the caret. Do you know how can I change the accent color in the SearchView to only be applied there? I've found that Play Music has the same problem.

我下面从Android开发者博客指南:

I'm following the guide from Android Developers blog:

<一个href="http://android-developers.blogspot.com.es/2014/10/appcompat-v21-material-design-for-$p$p.html">http://android-developers.blogspot.com.es/2014/10/appcompat-v21-material-design-for-$p$p.html

推荐答案

据我所看到的检索属性时搜索查看 suggestionRowLayout 资源价值出现搜索查看源代码对于搜索查看和方法 getSuggestionRowLayout()。另外V7库SuggestionAdapter的实施充气 abc_search_dropdown_item_icons_2line

According to what I have seen in the SearchView source suggestionRowLayout resource value in SearchView occurs when retrieving the attributes for the SearchView and in the method getSuggestionRowLayout(). On the other hand the implementation of SuggestionAdapter of v7 library is inflating abc_search_dropdown_item_icons_2line.

理念的一种解决方法:

尝试引用不同的布局与 refs.xml 帮助。请务必保持相同的ID为意见 abc_search_dropdown_item_icons_2line

Try referencing different layout with help of refs.xml. Make sure you keep same ids for views as in abc_search_dropdown_item_icons_2line

 <item type="layout" name="abc_search_dropdown_item_icons_2line">@layout/my_suggestion_row</item>

这篇关于风格化的搜索查看小工具使用支持库V21的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆