• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1page.title=Adding the App Bar
2page.tags="appbar","actionbar"
3helpoutsWidget=true
4trainingnavtop=true
5startpage=true
6
7@jd:body
8
9<div id="tb-wrapper">
10<div id="tb">
11
12<h2>You should also read</h2>
13<ul>
14  <li><a href="{@docRoot}training/implementing-navigation/index.html">
15    Implementing Effective Navigation</a></li>
16  <li><a href="http://www.google.com/design/spec/layout/structure.html#structure-app-bar">
17    Material Design: App Bar</a></li>
18</ul>
19
20</div>
21</div>
22
23<p>
24  The <em>app bar</em>, also known as the <em>action bar</em>, is one of the most
25  important design elements in your app's activities, because
26  it provides a visual structure and interactive elements that are familiar to
27  users. Using the app bar makes your app consistent with other Android apps,
28  allowing users to quickly understand how to operate your app and have a great
29  experience.
30  The key functions of the app bar
31  are as follows:
32</p>
33
34<ul>
35  <li>A dedicated space for giving your app an identity and indicating the
36  user's location in the app.
37  </li>
38
39  <li>Access to important actions in a predictable way, such as search.
40  </li>
41
42  <li>Support for navigation and view switching (with tabs or drop-down lists).
43  </li>
44</ul>
45
46<img src="{@docRoot}images/training/appbar/appbar_sheets_2x.png"
47    srcset="{@docRoot}images/training/appbar/appbar_sheets.png 1x,
48        {@docRoot}images/training/appbar/appbar_sheets_2x.png 2x"
49    width="400" alt="" />
50
51<p>
52  This class describes how to use the
53  <a href="{@docRoot}tools/support-library/features.html#v7-appcompat">v7
54  appcompat</a> support library's {@link
55  android.support.v7.widget.Toolbar} widget as an app bar. There are other ways
56  to implement an app bar—for example, some themes set up an {@link
57  android.app.ActionBar} as an app bar by default—but using the appcompat
58  {@link android.support.v7.widget.Toolbar} makes it easy to set up an app bar
59  that works on the widest range of devices, and also gives you room to
60  customize your app bar later on as your app develops.
61</p>
62
63<h2>Lessons</h2>
64
65<dl>
66  <dt>
67    <b><a href="setting-up.html">Setting Up the App Bar</a></b>
68  </dt>
69
70  <dd>
71    Learn how to add a {@link android.support.v7.widget.Toolbar} widget to your
72    activity, and set it as the activity's app bar.
73  </dd>
74
75  <dt>
76    <b><a href="actions.html">Adding and Handling Actions</a></b>
77  </dt>
78
79  <dd>
80    Learn how to add actions to the app bar and its overflow menu, and how to
81    respond when users choose those actions.
82  </dd>
83
84  <dt>
85    <b><a href="up-action.html">Adding an Up Action</a></b>
86  </dt>
87
88  <dd>
89    Learn how to add an <em>Up</em> button to your app bar, so users
90    can navigate back to the app's home screen.
91  </dd>
92
93  <dt>
94    <b><a href="action-views.html">Action Views and Action Providers</a></b>
95  </dt>
96
97  <dd>
98    Learn how to use these widgets to provide advanced functionality in your
99    app bar.
100  </dd>
101</dl>
102