Action Bar and Search View

In Android 4.0, because the action bar is available on phones, there is an increasing interest in using it as a search facility. This section shows how to use a search widget in the action bar.

We will provide code snippets that you can use to modify the project you have seen so far to include a search widget. Although we present only snippets, you can see the full code in the downloadable project for this chapter.

A search view widget is a search box that fits between your tabs and the menu icons in the action bar, as shown in Figure 10–7.


Figure 10–7. An action bar search view

You need to do the following to use ...

Get Pro Android 4 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.