Android: ActionBarSherlock search widget

Currently, I have an application in the game store for both tablets and Android 3.0+ smartphones ( http://tinyurl.com/cnejnjs ). To appeal to more users, I study how the application works on a large number of devices.

I know the ActionBar Sherlock, and that seems to do almost everything I want. One thing he does not offer is the Search Widget , which I use in the current application.

Is there a way to have a search box on the action bar that updates the current fragment of the list on the screen, similar to how the default search widget works?

+7
source share
1 answer

A search widget is just an extensible action item. You can create your own very easily using EditText as an advanced layout. You can see this in the โ€œFolding Action Itemโ€ example from Feature Demos (although this is just a very simple example).

You can also use the built-in widget on Honeycomb and from the compatibility library:

 Context context = getSupportActionBar().getThemedContext(); View searchView = SearchViewCompat.newSearchView(context); if (searchView != null) { //Use native implementation } else { //Use simple compatibility implementation } 

Support for 99% compatible implementation also on the roadmap .

+19
source

All Articles