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.

Image

Figure 10–7. An action bar search view

You need to do the following to use ...

Get Pro Android 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.