问题
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