The app bar, also known as the action bar, is one of the most important design elements in your app's activities, because it provides a visual structure and interactive elements that are familiar to users. Using the app bar makes your app consistent with other Android apps, allowing users to quickly understand how to operate your app and have a great experience. The key functions of the app bar are as follows:
- A dedicated space for giving your app an identity and indicating the user's location in the app.
- Access to important actions in a predictable way, such as search.
- Support for navigation and view switching (with tabs or drop-down lists).
This class describes how to use the
appcompat support library's
Toolbar widget as an app bar. There are other ways
to implement an app bar—for example, some themes set up an
ActionBar as an app bar by default—but using the appcompat
Toolbar makes it easy to set up an app bar
that works on the widest range of devices, and also gives you room to
customize your app bar later on as your app develops.
- Setting Up the App Bar
Learn how to add a
Toolbarwidget to your activity, and set it as the activity's app bar.
- Adding and Handling Actions
- Learn how to add actions to the app bar and its overflow menu, and how to respond when users choose those actions.
- Adding an Up Action
- Learn how to add an Up button to your app bar, so users can navigate back to the app's home screen.
- Action Views and Action Providers
- Learn how to use these widgets to provide advanced functionality in your app bar.