Tuesday, 23 December 2014

What are the Steps to Implement Search View on ActionBar ?

A Search View widget is a search box that fits between your tabs and the menu icons in the
action bar.

You need to do the following to use search in your action bar :

1- Define a menu item pointing to a search view provided by the SDK.You also need an activity into
which you can load this menu.This is often called the search invoker activity.

2- Create another activity that can take the query from the search view in step 1 and provide results.
This is often called the search results activity.

3- Create an XML file that allows you to customize the search view widget.This file is often called
searchable.xml and resides in the res / xml subdirectory.

4- Declare the search results activity in the manifest file.This definition needs to point to the XML file defined in step 3.

5- In your menu setup for the search invoker activity,indicate that the search view needs to target
the search results activity from step 2.

No comments:

Post a Comment