O'Reilly logo

Beginning Android 4 by Grant Allen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 27

Using the Action Bar

One of the easiest ways to make your application blend in better with the latest and greatest Android UI is to enable the action bar, introduced in Chapter 26. What makes it “easy” is that most of the basic functionality of the action bar is backward compatible—the Android 4.0 settings will not cause the application to crash on earlier versions of Android.

The sample project shown in this chapter is Menus/ActionBar, which extends the Menus/Inflation project shown in a previous chapter.

Enabling the Action Bar

By default, your Android application will not use the action bar. In fact, it will not even be displayed on the screen. If you want the action bar to appear on the screen, you need to include android:targetSdkVersion="11" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required