Adding an action bar

Almost all apps require some form of commanding, usually being frequently used. As a result, these commands should be presented in an easily consumed region of the screen, regardless of differences in screen configuration.

How to do it...

Adding an action bar is very simple and does not need many changes to our app, even if they are to run on the old versions of Android:

  1. By default, on Android 4.0, apps will have an action bar. To access this, we can use the ActionBar property on the Activity type:
    ActionBar.Title = "Xamarin Cookbook"; 

To provide an action bar to previous versions of Android, we use the Android Support Libraries:

  1. First, we need to install the Xamarin Support Library v7 AppCompat Component or NuGet.
  2. Then, we need ...

Get Xamarin Mobile Development for Android Cookbook 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.