1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 Copyright 2013 The Android Open Source Project
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9     http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16-->
17
18<sample>
19    <name>DoneBar</name>
20    <group>UI</group>
21    <package>com.example.android.donebar</package>
22
23    <!-- change minSdk if needed-->
24    <minSdk>14</minSdk>
25
26    <strings>
27        <intro>
28            <![CDATA[
29                This sample demonstrates two alternative presentations of the
30                action bar that are well-suited for simple data entry scenarios.
31
32                In this presentation, a done bar replaces the action
33                bar entirely, providing two direct actions to persist or dismiss changes. This is
34                suitable for cases where no additional view details or actions are needed in the
35                action bar.
36            ]]>
37        </intro>
38    </strings>
39
40    <activity>
41        <class>DoneBarActivity</class>
42        <title>Done Bar</title>
43        <description>In this presentation, a done bar replaces the action bar entirely, providing
44            two direct actions to persist or dismiss changes. This is suitable for cases where no
45            additional view details or actions are needed in the action bar.</description>
46    </activity>
47
48    <activity>
49        <class>DoneButtonActivity</class>
50        <title>Done Button</title>
51        <description>In this presentation, a done button replaces the action bar\'s "Up" affordance
52            and app icon, while the cancel action is made available in the action overflow. This is
53            well-suited to scenarios where additional view details or
54            actions may be needed in the action bar.</description>
55    </activity>
56
57    <template src="base"/>
58    <template src="ActivityCards"/>
59
60    <metadata>
61        <status>PUBLISHED</status>
62        <categories>UI</categories>
63        <technologies>Android</technologies>
64        <languages>Java</languages>
65        <solutions>Mobile</solutions>
66        <level>INTERMEDIATE</level>
67        <icon>screenshots/icon-web.png</icon>
68        <screenshots>
69            <img>screenshots/1-main.png</img>
70            <img>screenshots/2-done-bar.png</img>
71            <img>screenshots/3-done-button.png</img>
72        </screenshots>
73        <api_refs>
74            <android>android.app.ActionBar</android>
75        </api_refs>
76        <description>
77This sample shows how to create a custom view in the ActionBar to show a done button, using
782 alternative layouts. This is well suited for simple data entry activities, where the only
79options for the user are to cancel or confirm the data changes.
80        </description>
81        <intro>
82API 11 introduced the [ActionBar][1] as a navigational UI element. In most cases, a custom view isn't required
83or even recommended, as using a menu xml file is all that is needed to add action icons to it. However, it is
84possible to use a custom view and it is useful in some cases.
85
86This sample contains two activities with custom views in their action bar, each with a "done" button. These are
87designed to be used with simple data entry screen where the only options for the user are to cancel or confirm
88the changes.
89
901. Create a layout for the [ActionBar][2].
912. In the activity, before setting the content view, inflate the view using the LayoutInflater.
923. Use `getActionBar()` to get the ActionBar, and set the display options with `ActionBar.DISPLAY_SHOW_CUSTOM`.
934. Set the custom view by calling `setCustomView(customActionBarView, new ActionBar.LayoutParams(
94ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT))` on the ActionBar.
955. You can now set the content view of the Activity.
96
97
98[1]: http://developer.android.com/design/patterns/actionbar.html
99[2]: http://developer.android.com/reference/android/app/ActionBar.html
100        </intro>
101    </metadata>
102
103</sample>
104