Android SearchView定制 [英] Android SearchView customisation

查看:107
本文介绍了Android SearchView定制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是android的新手,我陷入了一些我认为很简单但很困惑的事情. 我需要在操作栏/工具栏中而不是在我的Relativelayout中创建自定义searchView.问题是我不知道如何自定义XML的背景,文本输入颜色,搜索图标颜色,或者仅仅是它们的属性.目前我在手机上无法显示我的代码.有人告诉我如何定制它吗?也许给我看我可以遵循的任何教程?在此先感谢!!!!

im new to android and i got stucked on something that i think it's simple but i got confused.. I need to make a custom searchView not in the actionbar/toolbar but in my Relativelayout. The problem is that i don't know hot to customise the background , textinput color , the search icon color in XML , or just the attributes of them . At the moment im on my phone and can't show my code . Does anyone tell me how i can customise it ? Maybe showing me any tutorial i can follow ? Thanks in advance !!!!

推荐答案

我建议您看看我在此处给出的用来设置自己的SearchBar样式的答案.

I suggest you to look at my answer I gave here to style your own SearchBar.

我不知道原因,但无法为Google的默认SearchBar设置样式,因此必须创建自己的Search bar.

I can't get the reason but I couldn't style Google's default SearchBar so I had to create my own Search bar.

这是我的做法:

在Android上为样式搜索视图(min21)

如果您想实现InstantSearch算法,请遵循这位出色的作者及其项目(查看接受的答案):

If you want to implement an InstantSearch algorithm follow this great author and his project (look at the accepted answer):

如何使用SearchView过滤RecyclerView

如果您需要进一步的帮助,请发表评论. 如果答案有帮助,也可以提高我的答案:P

If you need further help just leave a comment. If the answer helped also upvote my answer :P

更新:这是Google对搜索视图的实现,只是为了向您提供更多信息:

UPDATE: Here's Google's implementation of the Search View, just to give you more information: https://developer.android.com/guide/topics/search/search-dialog.html

祝你有美好的一天:)

这篇关于Android SearchView定制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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