Android - custom quick search box

我只是一个虾纸丫 提交于 2020-01-06 17:57:41

问题


If you using Twitter for Android you can see that clicking on phone's hard search button brings fully customized quick search-like control. Now I'm not saying that it IS stock Android customized quick search but how would one build something like that? I want quick search box behavior but I also want add some additional selectors (think Firefox search where on the left there's a dropdown to select search engine) I suspect that clicking search brings another activity that just looks like a quick search. Now I know how to trigger search activity from the quick search but how to intercept quick box call and display your activity instead? Where would I start with something like that? Any hints and pointers will be greatly appreciated


回答1:


With no screenshot, I can't help terribly much, since I don't use the official Twitter app (I'm a Seesmic guy), so I don't quite know what you are talking about.

You can override onSearchRequested() to get control when the user requests a search in your activity. Return true to say you're handling the search yourself. Along the way, pop up whatever you like to allow the user to do a search.



来源:https://stackoverflow.com/questions/4150904/android-custom-quick-search-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!