1/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.support.v7.app;
18
19import android.content.Context;
20import android.content.res.Configuration;
21import android.content.res.TypedArray;
22import android.graphics.drawable.Drawable;
23import android.support.annotation.DrawableRes;
24import android.support.annotation.IntDef;
25import android.support.annotation.NonNull;
26import android.support.annotation.Nullable;
27import android.support.annotation.StringRes;
28import android.support.v4.app.Fragment;
29import android.support.v4.app.FragmentManager;
30import android.support.v4.app.FragmentTransaction;
31import android.support.v4.view.GravityCompat;
32import android.support.v7.appcompat.R;
33import android.support.v7.view.ActionMode;
34import android.util.AttributeSet;
35import android.view.Gravity;
36import android.view.KeyEvent;
37import android.view.View;
38import android.view.ViewGroup;
39import android.view.Window;
40import android.widget.SpinnerAdapter;
41
42import java.lang.annotation.Retention;
43import java.lang.annotation.RetentionPolicy;
44
45/**
46 * A primary toolbar within the activity that may display the activity title, application-level
47 * navigation affordances, and other interactive items.
48 *
49 * <p>Beginning with Android 3.0 (API level 11), the action bar appears at the top of an
50 * activity's window when the activity uses the system's {@link
51 * android.R.style#Theme_Holo Holo} theme (or one of its descendant themes), which is the default.
52 * You may otherwise add the action bar by calling {@link
53 * android.view.Window#requestFeature requestFeature(FEATURE_ACTION_BAR)} or by declaring it in a
54 * custom theme with the {@link android.R.styleable#Theme_windowActionBar windowActionBar} property.
55 * </p>
56 *
57 * <p>Beginning with Android L (API level 21), the action bar may be represented by any
58 * Toolbar widget within the application layout. The application may signal to the Activity
59 * which Toolbar should be treated as the Activity's action bar. Activities that use this
60 * feature should use one of the supplied <code>.NoActionBar</code> themes, set the
61 * {@link android.R.styleable#Theme_windowActionBar windowActionBar} attribute to <code>false</code>
62 * or otherwise not request the window feature.</p>
63 *
64 * <p>By adjusting the window features requested by the theme and the layouts used for
65 * an Activity's content view, an app can use the standard system action bar on older platform
66 * releases and the newer inline toolbars on newer platform releases. The <code>ActionBar</code>
67 * object obtained from the Activity can be used to control either configuration transparently.</p>
68 *
69 * <p>When using the Holo themes the action bar shows the application icon on
70 * the left, followed by the activity title. If your activity has an options menu, you can make
71 * select items accessible directly from the action bar as "action items". You can also
72 * modify various characteristics of the action bar or remove it completely.</p>
73 *
74 * <p>When using the Material themes (default in API 21 or newer) the navigation button
75 * (formerly "Home") takes over the space previously occupied by the application icon.
76 * Apps wishing to express a stronger branding should use their brand colors heavily
77 * in the action bar and other application chrome or use a {@link #setLogo(int) logo}
78 * in place of their standard title text.</p>
79 *
80 * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link
81 * android.app.Activity#getActionBar getActionBar()}.</p>
82 *
83 * <p>In some cases, the action bar may be overlayed by another bar that enables contextual actions,
84 * using an {@link android.view.ActionMode}. For example, when the user selects one or more items in
85 * your activity, you can enable an action mode that offers actions specific to the selected
86 * items, with a UI that temporarily replaces the action bar. Although the UI may occupy the
87 * same space, the {@link android.view.ActionMode} APIs are distinct and independent from those for
88 * {@link ActionBar}.</p>
89 *
90 * <div class="special reference">
91 * <h3>Developer Guides</h3>
92 * <p>For information about how to use the action bar, including how to add action items, navigation
93 * modes and more, read the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action
94 * Bar</a> developer guide.</p>
95 * </div>
96 */
97public abstract class ActionBar {
98
99    /** @hide */
100    @Retention(RetentionPolicy.SOURCE)
101    @IntDef({NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS})
102    public @interface NavigationMode {}
103
104    /**
105     * Standard navigation mode. Consists of either a logo or icon
106     * and title text with an optional subtitle. Clicking any of these elements
107     * will dispatch onOptionsItemSelected to the host Activity with
108     * a MenuItem with item ID android.R.id.home.
109     *
110     * @deprecated Action bar navigation modes are deprecated and not supported by inline
111     * toolbar action bars. Consider using other
112     * <a href="http://developer.android.com/design/patterns/navigation.html">common
113     * navigation patterns</a> instead.
114     */
115    public static final int NAVIGATION_MODE_STANDARD = 0;
116
117    /**
118     * List navigation mode. Instead of static title text this mode
119     * presents a list menu for navigation within the activity.
120     * e.g. this might be presented to the user as a dropdown list.
121     *
122     * @deprecated Action bar navigation modes are deprecated and not supported by inline
123     * toolbar action bars. Consider using other
124     * <a href="http://developer.android.com/design/patterns/navigation.html">common
125     * navigation patterns</a> instead.
126     */
127    public static final int NAVIGATION_MODE_LIST = 1;
128
129    /**
130     * Tab navigation mode. Instead of static title text this mode
131     * presents a series of tabs for navigation within the activity.
132     *
133     * @deprecated Action bar navigation modes are deprecated and not supported by inline
134     * toolbar action bars. Consider using other
135     * <a href="http://developer.android.com/design/patterns/navigation.html">common
136     * navigation patterns</a> instead.
137     */
138    public static final int NAVIGATION_MODE_TABS = 2;
139
140    /** @hide */
141    @IntDef(flag=true, value={
142            DISPLAY_USE_LOGO,
143            DISPLAY_SHOW_HOME,
144            DISPLAY_HOME_AS_UP,
145            DISPLAY_SHOW_TITLE,
146            DISPLAY_SHOW_CUSTOM
147    })
148    @Retention(RetentionPolicy.SOURCE)
149    public @interface DisplayOptions {}
150
151    /**
152     * Use logo instead of icon if available. This flag will cause appropriate
153     * navigation modes to use a wider logo in place of the standard icon.
154     *
155     * @see #setDisplayOptions(int)
156     * @see #setDisplayOptions(int, int)
157     */
158    public static final int DISPLAY_USE_LOGO = 0x1;
159
160    /**
161     * Show 'home' elements in this action bar, leaving more space for other
162     * navigation elements. This includes logo and icon.
163     *
164     * @see #setDisplayOptions(int)
165     * @see #setDisplayOptions(int, int)
166     */
167    public static final int DISPLAY_SHOW_HOME = 0x2;
168
169    /**
170     * Display the 'home' element such that it appears as an 'up' affordance.
171     * e.g. show an arrow to the left indicating the action that will be taken.
172     *
173     * Set this flag if selecting the 'home' button in the action bar to return
174     * up by a single level in your UI rather than back to the top level or front page.
175     *
176     * <p>Setting this option will implicitly enable interaction with the home/up
177     * button. See {@link #setHomeButtonEnabled(boolean)}.
178     *
179     * @see #setDisplayOptions(int)
180     * @see #setDisplayOptions(int, int)
181     */
182    public static final int DISPLAY_HOME_AS_UP = 0x4;
183
184    /**
185     * Show the activity title and subtitle, if present.
186     *
187     * @see #setTitle(CharSequence)
188     * @see #setTitle(int)
189     * @see #setSubtitle(CharSequence)
190     * @see #setSubtitle(int)
191     * @see #setDisplayOptions(int)
192     * @see #setDisplayOptions(int, int)
193     */
194    public static final int DISPLAY_SHOW_TITLE = 0x8;
195
196    /**
197     * Show the custom view if one has been set.
198     *
199     * @see #setCustomView(View)
200     * @see #setDisplayOptions(int)
201     * @see #setDisplayOptions(int, int)
202     */
203    public static final int DISPLAY_SHOW_CUSTOM = 0x10;
204
205    /**
206     * Set the action bar into custom navigation mode, supplying a view
207     * for custom navigation.
208     *
209     * Custom navigation views appear between the application icon and
210     * any action buttons and may use any space available there. Common
211     * use cases for custom navigation views might include an auto-suggesting
212     * address bar for a browser or other navigation mechanisms that do not
213     * translate well to provided navigation modes.
214     *
215     * @param view Custom navigation view to place in the ActionBar.
216     */
217    public abstract void setCustomView(View view);
218
219    /**
220     * Set the action bar into custom navigation mode, supplying a view
221     * for custom navigation.
222     *
223     * <p>Custom navigation views appear between the application icon and
224     * any action buttons and may use any space available there. Common
225     * use cases for custom navigation views might include an auto-suggesting
226     * address bar for a browser or other navigation mechanisms that do not
227     * translate well to provided navigation modes.</p>
228     *
229     * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for
230     * the custom view to be displayed.</p>
231     *
232     * @param view Custom navigation view to place in the ActionBar.
233     * @param layoutParams How this custom view should layout in the bar.
234     *
235     * @see #setDisplayOptions(int, int)
236     */
237    public abstract void setCustomView(View view, LayoutParams layoutParams);
238
239    /**
240     * Set the action bar into custom navigation mode, supplying a view
241     * for custom navigation.
242     *
243     * <p>Custom navigation views appear between the application icon and
244     * any action buttons and may use any space available there. Common
245     * use cases for custom navigation views might include an auto-suggesting
246     * address bar for a browser or other navigation mechanisms that do not
247     * translate well to provided navigation modes.</p>
248     *
249     * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for
250     * the custom view to be displayed.</p>
251     *
252     * @param resId Resource ID of a layout to inflate into the ActionBar.
253     *
254     * @see #setDisplayOptions(int, int)
255     */
256    public abstract void setCustomView(int resId);
257
258    /**
259     * Set the icon to display in the 'home' section of the action bar.
260     * The action bar will use an icon specified by its style or the
261     * activity icon by default.
262     *
263     * Whether the home section shows an icon or logo is controlled
264     * by the display option {@link #DISPLAY_USE_LOGO}.
265     *
266     * @param resId Resource ID of a drawable to show as an icon.
267     *
268     * @see #setDisplayUseLogoEnabled(boolean)
269     * @see #setDisplayShowHomeEnabled(boolean)
270     */
271    public abstract void setIcon(@DrawableRes int resId);
272
273    /**
274     * Set the icon to display in the 'home' section of the action bar.
275     * The action bar will use an icon specified by its style or the
276     * activity icon by default.
277     *
278     * Whether the home section shows an icon or logo is controlled
279     * by the display option {@link #DISPLAY_USE_LOGO}.
280     *
281     * @param icon Drawable to show as an icon.
282     *
283     * @see #setDisplayUseLogoEnabled(boolean)
284     * @see #setDisplayShowHomeEnabled(boolean)
285     */
286    public abstract void setIcon(Drawable icon);
287
288    /**
289     * Set the logo to display in the 'home' section of the action bar.
290     * The action bar will use a logo specified by its style or the
291     * activity logo by default.
292     *
293     * Whether the home section shows an icon or logo is controlled
294     * by the display option {@link #DISPLAY_USE_LOGO}.
295     *
296     * @param resId Resource ID of a drawable to show as a logo.
297     *
298     * @see #setDisplayUseLogoEnabled(boolean)
299     * @see #setDisplayShowHomeEnabled(boolean)
300     */
301    public abstract void setLogo(@DrawableRes int resId);
302
303    /**
304     * Set the logo to display in the 'home' section of the action bar.
305     * The action bar will use a logo specified by its style or the
306     * activity logo by default.
307     *
308     * Whether the home section shows an icon or logo is controlled
309     * by the display option {@link #DISPLAY_USE_LOGO}.
310     *
311     * @param logo Drawable to show as a logo.
312     *
313     * @see #setDisplayUseLogoEnabled(boolean)
314     * @see #setDisplayShowHomeEnabled(boolean)
315     */
316    public abstract void setLogo(Drawable logo);
317
318    /**
319     * Set the adapter and navigation callback for list navigation mode.
320     *
321     * The supplied adapter will provide views for the expanded list as well as
322     * the currently selected item. (These may be displayed differently.)
323     *
324     * The supplied OnNavigationListener will alert the application when the user
325     * changes the current list selection.
326     *
327     * @param adapter An adapter that will provide views both to display
328     *                the current navigation selection and populate views
329     *                within the dropdown navigation menu.
330     * @param callback An OnNavigationListener that will receive events when the user
331     *                 selects a navigation item.
332     *
333     * @deprecated Action bar navigation modes are deprecated and not supported by inline
334     * toolbar action bars. Consider using other
335     * <a href="http://developer.android.com/design/patterns/navigation.html">common
336     * navigation patterns</a> instead.
337     */
338    public abstract void setListNavigationCallbacks(SpinnerAdapter adapter,
339            OnNavigationListener callback);
340
341    /**
342     * Set the selected navigation item in list or tabbed navigation modes.
343     *
344     * @param position Position of the item to select.
345     *
346     * @deprecated Action bar navigation modes are deprecated and not supported by inline
347     * toolbar action bars. Consider using other
348     * <a href="http://developer.android.com/design/patterns/navigation.html">common
349     * navigation patterns</a> instead.
350     */
351    public abstract void setSelectedNavigationItem(int position);
352
353    /**
354     * Get the position of the selected navigation item in list or tabbed navigation modes.
355     *
356     * @return Position of the selected item.
357     *
358     * @deprecated Action bar navigation modes are deprecated and not supported by inline
359     * toolbar action bars. Consider using other
360     * <a href="http://developer.android.com/design/patterns/navigation.html">common
361     * navigation patterns</a> instead.
362     */
363    public abstract int getSelectedNavigationIndex();
364
365    /**
366     * Get the number of navigation items present in the current navigation mode.
367     *
368     * @return Number of navigation items.
369     *
370     * @deprecated Action bar navigation modes are deprecated and not supported by inline
371     * toolbar action bars. Consider using other
372     * <a href="http://developer.android.com/design/patterns/navigation.html">common
373     * navigation patterns</a> instead.
374     */
375    public abstract int getNavigationItemCount();
376
377    /**
378     * Set the action bar's title. This will only be displayed if
379     * {@link #DISPLAY_SHOW_TITLE} is set.
380     *
381     * @param title Title to set
382     *
383     * @see #setTitle(int)
384     * @see #setDisplayOptions(int, int)
385     */
386    public abstract void setTitle(CharSequence title);
387
388    /**
389     * Set the action bar's title. This will only be displayed if
390     * {@link #DISPLAY_SHOW_TITLE} is set.
391     *
392     * @param resId Resource ID of title string to set
393     *
394     * @see #setTitle(CharSequence)
395     * @see #setDisplayOptions(int, int)
396     */
397    public abstract void setTitle(@StringRes int resId);
398
399    /**
400     * Set the action bar's subtitle. This will only be displayed if
401     * {@link #DISPLAY_SHOW_TITLE} is set. Set to null to disable the
402     * subtitle entirely.
403     *
404     * @param subtitle Subtitle to set
405     *
406     * @see #setSubtitle(int)
407     * @see #setDisplayOptions(int, int)
408     */
409    public abstract void setSubtitle(CharSequence subtitle);
410
411    /**
412     * Set the action bar's subtitle. This will only be displayed if
413     * {@link #DISPLAY_SHOW_TITLE} is set.
414     *
415     * @param resId Resource ID of subtitle string to set
416     *
417     * @see #setSubtitle(CharSequence)
418     * @see #setDisplayOptions(int, int)
419     */
420    public abstract void setSubtitle(int resId);
421
422    /**
423     * Set display options. This changes all display option bits at once. To change
424     * a limited subset of display options, see {@link #setDisplayOptions(int, int)}.
425     *
426     * @param options A combination of the bits defined by the DISPLAY_ constants
427     *                defined in ActionBar.
428     */
429    public abstract void setDisplayOptions(@DisplayOptions int options);
430
431    /**
432     * Set selected display options. Only the options specified by mask will be changed.
433     * To change all display option bits at once, see {@link #setDisplayOptions(int)}.
434     *
435     * <p>Example: setDisplayOptions(0, DISPLAY_SHOW_HOME) will disable the
436     * {@link #DISPLAY_SHOW_HOME} option.
437     * setDisplayOptions(DISPLAY_SHOW_HOME, DISPLAY_SHOW_HOME | DISPLAY_USE_LOGO)
438     * will enable {@link #DISPLAY_SHOW_HOME} and disable {@link #DISPLAY_USE_LOGO}.
439     *
440     * @param options A combination of the bits defined by the DISPLAY_ constants
441     *                defined in ActionBar.
442     * @param mask A bit mask declaring which display options should be changed.
443     */
444    public abstract void setDisplayOptions(@DisplayOptions int options, @DisplayOptions int mask);
445
446    /**
447     * Set whether to display the activity logo rather than the activity icon.
448     * A logo is often a wider, more detailed image.
449     *
450     * <p>To set several display options at once, see the setDisplayOptions methods.
451     *
452     * @param useLogo true to use the activity logo, false to use the activity icon.
453     *
454     * @see #setDisplayOptions(int)
455     * @see #setDisplayOptions(int, int)
456     */
457    public abstract void setDisplayUseLogoEnabled(boolean useLogo);
458
459    /**
460     * Set whether to include the application home affordance in the action bar.
461     * Home is presented as either an activity icon or logo.
462     *
463     * <p>To set several display options at once, see the setDisplayOptions methods.
464     *
465     * @param showHome true to show home, false otherwise.
466     *
467     * @see #setDisplayOptions(int)
468     * @see #setDisplayOptions(int, int)
469     */
470    public abstract void setDisplayShowHomeEnabled(boolean showHome);
471
472    /**
473     * Set whether home should be displayed as an "up" affordance.
474     * Set this to true if selecting "home" returns up by a single level in your UI
475     * rather than back to the top level or front page.
476     *
477     * <p>To set several display options at once, see the setDisplayOptions methods.
478     *
479     * @param showHomeAsUp true to show the user that selecting home will return one
480     *                     level up rather than to the top level of the app.
481     *
482     * @see #setDisplayOptions(int)
483     * @see #setDisplayOptions(int, int)
484     */
485    public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp);
486
487    /**
488     * Set whether an activity title/subtitle should be displayed.
489     *
490     * <p>To set several display options at once, see the setDisplayOptions methods.
491     *
492     * @param showTitle true to display a title/subtitle if present.
493     * @see #setDisplayOptions(int)
494     * @see #setDisplayOptions(int, int)
495     */
496    public abstract void setDisplayShowTitleEnabled(boolean showTitle);
497
498    /**
499     * Set whether a custom view should be displayed, if set.
500     *
501     * <p>To set several display options at once, see the setDisplayOptions methods.
502     *
503     * @param showCustom true if the currently set custom view should be displayed, false otherwise.
504     *
505     * @see #setDisplayOptions(int)
506     * @see #setDisplayOptions(int, int)
507     */
508    public abstract void setDisplayShowCustomEnabled(boolean showCustom);
509
510    /**
511     * Set the ActionBar's background. This will be used for the primary
512     * action bar.
513     *
514     * @param d Background drawable
515     * @see #setStackedBackgroundDrawable(Drawable)
516     * @see #setSplitBackgroundDrawable(Drawable)
517     */
518    public abstract void setBackgroundDrawable(@Nullable Drawable d);
519
520    /**
521     * Set the ActionBar's stacked background. This will appear
522     * in the second row/stacked bar on some devices and configurations.
523     *
524     * @param d Background drawable for the stacked row
525     */
526    public void setStackedBackgroundDrawable(Drawable d) { }
527
528    /**
529     * Set the ActionBar's split background. This will appear in
530     * the split action bar containing menu-provided action buttons
531     * on some devices and configurations.
532     * <p>You can enable split action bar with {@link android.R.attr#uiOptions}
533     *
534     * @param d Background drawable for the split bar
535     */
536    public void setSplitBackgroundDrawable(Drawable d) { }
537
538    /**
539     * @return The current custom view.
540     */
541    public abstract View getCustomView();
542
543    /**
544     * Returns the current ActionBar title in standard mode.
545     * Returns null if {@link #getNavigationMode()} would not return
546     * {@link #NAVIGATION_MODE_STANDARD}.
547     *
548     * @return The current ActionBar title or null.
549     */
550    @Nullable
551    public abstract CharSequence getTitle();
552
553    /**
554     * Returns the current ActionBar subtitle in standard mode.
555     * Returns null if {@link #getNavigationMode()} would not return
556     * {@link #NAVIGATION_MODE_STANDARD}.
557     *
558     * @return The current ActionBar subtitle or null.
559     */
560    @Nullable
561    public abstract CharSequence getSubtitle();
562
563    /**
564     * Returns the current navigation mode. The result will be one of:
565     * <ul>
566     * <li>{@link #NAVIGATION_MODE_STANDARD}</li>
567     * <li>{@link #NAVIGATION_MODE_LIST}</li>
568     * <li>{@link #NAVIGATION_MODE_TABS}</li>
569     * </ul>
570     *
571     * @return The current navigation mode.
572     *
573     * @deprecated Action bar navigation modes are deprecated and not supported by inline
574     * toolbar action bars. Consider using other
575     * <a href="http://developer.android.com/design/patterns/navigation.html">common
576     * navigation patterns</a> instead.
577     */
578    @NavigationMode
579    public abstract int getNavigationMode();
580
581    /**
582     * Set the current navigation mode.
583     *
584     * @param mode The new mode to set.
585     * @see #NAVIGATION_MODE_STANDARD
586     * @see #NAVIGATION_MODE_LIST
587     * @see #NAVIGATION_MODE_TABS
588     *
589     * @deprecated Action bar navigation modes are deprecated and not supported by inline
590     * toolbar action bars. Consider using other
591     * <a href="http://developer.android.com/design/patterns/navigation.html">common
592     * navigation patterns</a> instead.
593     */
594    public abstract void setNavigationMode(@NavigationMode int mode);
595
596    /**
597     * @return The current set of display options.
598     */
599    @DisplayOptions
600    public abstract int getDisplayOptions();
601
602    /**
603     * Create and return a new {@link Tab}.
604     * This tab will not be included in the action bar until it is added.
605     *
606     * <p>Very often tabs will be used to switch between {@link Fragment}
607     * objects.  Here is a typical implementation of such tabs:</p>
608     *
609     * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentTabs.java
610     *      complete}
611     *
612     * @return A new Tab
613     *
614     * @see #addTab(Tab)
615     *
616     * @deprecated Action bar navigation modes are deprecated and not supported by inline
617     * toolbar action bars. Consider using other
618     * <a href="http://developer.android.com/design/patterns/navigation.html">common
619     * navigation patterns</a> instead.
620     */
621    public abstract Tab newTab();
622
623    /**
624     * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list.
625     * If this is the first tab to be added it will become the selected tab.
626     *
627     * @param tab Tab to add
628     *
629     * @deprecated Action bar navigation modes are deprecated and not supported by inline
630     * toolbar action bars. Consider using other
631     * <a href="http://developer.android.com/design/patterns/navigation.html">common
632     * navigation patterns</a> instead.
633     */
634    public abstract void addTab(Tab tab);
635
636    /**
637     * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list.
638     *
639     * @param tab Tab to add
640     * @param setSelected True if the added tab should become the selected tab.
641     *
642     * @deprecated Action bar navigation modes are deprecated and not supported by inline
643     * toolbar action bars. Consider using other
644     * <a href="http://developer.android.com/design/patterns/navigation.html">common
645     * navigation patterns</a> instead.
646     */
647    public abstract void addTab(Tab tab, boolean setSelected);
648
649    /**
650     * Add a tab for use in tabbed navigation mode. The tab will be inserted at
651     * <code>position</code>. If this is the first tab to be added it will become
652     * the selected tab.
653     *
654     * @param tab The tab to add
655     * @param position The new position of the tab
656     *
657     * @deprecated Action bar navigation modes are deprecated and not supported by inline
658     * toolbar action bars. Consider using other
659     * <a href="http://developer.android.com/design/patterns/navigation.html">common
660     * navigation patterns</a> instead.
661     */
662    public abstract void addTab(Tab tab, int position);
663
664    /**
665     * Add a tab for use in tabbed navigation mode. The tab will be insterted at
666     * <code>position</code>.
667     *
668     * @param tab The tab to add
669     * @param position The new position of the tab
670     * @param setSelected True if the added tab should become the selected tab.
671     *
672     * @deprecated Action bar navigation modes are deprecated and not supported by inline
673     * toolbar action bars. Consider using other
674     * <a href="http://developer.android.com/design/patterns/navigation.html">common
675     * navigation patterns</a> instead.
676     */
677    public abstract void addTab(Tab tab, int position, boolean setSelected);
678
679    /**
680     * Remove a tab from the action bar. If the removed tab was selected it will be deselected
681     * and another tab will be selected if present.
682     *
683     * @param tab The tab to remove
684     *
685     * @deprecated Action bar navigation modes are deprecated and not supported by inline
686     * toolbar action bars. Consider using other
687     * <a href="http://developer.android.com/design/patterns/navigation.html">common
688     * navigation patterns</a> instead.
689     */
690    public abstract void removeTab(Tab tab);
691
692    /**
693     * Remove a tab from the action bar. If the removed tab was selected it will be deselected
694     * and another tab will be selected if present.
695     *
696     * @param position Position of the tab to remove
697     *
698     * @deprecated Action bar navigation modes are deprecated and not supported by inline
699     * toolbar action bars. Consider using other
700     * <a href="http://developer.android.com/design/patterns/navigation.html">common
701     * navigation patterns</a> instead.
702     */
703    public abstract void removeTabAt(int position);
704
705    /**
706     * Remove all tabs from the action bar and deselect the current tab.
707     *
708     * @deprecated Action bar navigation modes are deprecated and not supported by inline
709     * toolbar action bars. Consider using other
710     * <a href="http://developer.android.com/design/patterns/navigation.html">common
711     * navigation patterns</a> instead.
712     */
713    public abstract void removeAllTabs();
714
715    /**
716     * Select the specified tab. If it is not a child of this action bar it will be added.
717     *
718     * <p>Note: If you want to select by index, use {@link #setSelectedNavigationItem(int)}.</p>
719     *
720     * @param tab Tab to select
721     *
722     * @deprecated Action bar navigation modes are deprecated and not supported by inline
723     * toolbar action bars. Consider using other
724     * <a href="http://developer.android.com/design/patterns/navigation.html">common
725     * navigation patterns</a> instead.
726     */
727    public abstract void selectTab(Tab tab);
728
729    /**
730     * Returns the currently selected tab if in tabbed navigation mode and there is at least
731     * one tab present.
732     *
733     * @return The currently selected tab or null
734     *
735     * @deprecated Action bar navigation modes are deprecated and not supported by inline
736     * toolbar action bars. Consider using other
737     * <a href="http://developer.android.com/design/patterns/navigation.html">common
738     * navigation patterns</a> instead.
739     */
740    @Nullable
741    public abstract Tab getSelectedTab();
742
743    /**
744     * Returns the tab at the specified index.
745     *
746     * @param index Index value in the range 0-get
747     * @return
748     *
749     * @deprecated Action bar navigation modes are deprecated and not supported by inline
750     * toolbar action bars. Consider using other
751     * <a href="http://developer.android.com/design/patterns/navigation.html">common
752     * navigation patterns</a> instead.
753     */
754    public abstract Tab getTabAt(int index);
755
756    /**
757     * Returns the number of tabs currently registered with the action bar.
758     *
759     * @return Tab count
760     *
761     * @deprecated Action bar navigation modes are deprecated and not supported by inline
762     * toolbar action bars. Consider using other
763     * <a href="http://developer.android.com/design/patterns/navigation.html">common
764     * navigation patterns</a> instead.
765     */
766    public abstract int getTabCount();
767
768    /**
769     * Retrieve the current height of the ActionBar.
770     *
771     * @return The ActionBar's height
772     */
773    public abstract int getHeight();
774
775    /**
776     * Show the ActionBar if it is not currently showing.
777     * If the window hosting the ActionBar does not have the feature
778     * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application
779     * content to fit the new space available.
780     *
781     * <p>If you are hiding the ActionBar through
782     * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN},
783     * you should not call this function directly.
784     */
785    public abstract void show();
786
787    /**
788     * Hide the ActionBar if it is currently showing.
789     * If the window hosting the ActionBar does not have the feature
790     * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application
791     * content to fit the new space available.
792     *
793     * <p>Instead of calling this function directly, you can also cause an
794     * ActionBar using the overlay feature to hide through
795     * {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}.
796     * Hiding the ActionBar through this system UI flag allows you to more
797     * seamlessly hide it in conjunction with other screen decorations.
798     */
799    public abstract void hide();
800
801    /**
802     * @return <code>true</code> if the ActionBar is showing, <code>false</code> otherwise.
803     */
804    public abstract boolean isShowing();
805
806    /**
807     * Add a listener that will respond to menu visibility change events.
808     *
809     * @param listener The new listener to add
810     */
811    public abstract void addOnMenuVisibilityListener(OnMenuVisibilityListener listener);
812
813    /**
814     * Remove a menu visibility listener. This listener will no longer receive menu
815     * visibility change events.
816     *
817     * @param listener A listener to remove that was previously added
818     */
819    public abstract void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener);
820
821    /**
822     * Enable or disable the "home" button in the corner of the action bar. (Note that this
823     * is the application home/up affordance on the action bar, not the systemwide home
824     * button.)
825     *
826     * <p>This defaults to true for packages targeting &lt; API 14. For packages targeting
827     * API 14 or greater, the application should call this method to enable interaction
828     * with the home/up affordance.
829     *
830     * <p>Setting the {@link #DISPLAY_HOME_AS_UP} display option will automatically enable
831     * the home button.
832     *
833     * @param enabled true to enable the home button, false to disable the home button.
834     */
835    public void setHomeButtonEnabled(boolean enabled) { }
836
837    /**
838     * Returns a {@link Context} with an appropriate theme for creating views that
839     * will appear in the action bar. If you are inflating or instantiating custom views
840     * that will appear in an action bar, you should use the Context returned by this method.
841     * (This includes adapters used for list navigation mode.)
842     * This will ensure that views contrast properly against the action bar.
843     *
844     * @return A themed Context for creating views
845     */
846    public Context getThemedContext() {
847        return null;
848    }
849
850    /**
851     * Returns true if the Title field has been truncated during layout for lack
852     * of available space.
853     *
854     * @return true if the Title field has been truncated
855     * @hide pending API approval
856     */
857    public boolean isTitleTruncated() { return false; }
858
859    /**
860     * Set an alternate drawable to display next to the icon/logo/title
861     * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using
862     * this mode to display an alternate selection for up navigation, such as a sliding drawer.
863     *
864     * <p>If you pass <code>null</code> to this method, the default drawable from the theme
865     * will be used.</p>
866     *
867     * <p>If you implement alternate or intermediate behavior around Up, you should also
868     * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()}
869     * to provide a correct description of the action for accessibility support.</p>
870     *
871     * @param indicator A drawable to use for the up indicator, or null to use the theme's default
872     *
873     * @see #setDisplayOptions(int, int)
874     * @see #setDisplayHomeAsUpEnabled(boolean)
875     * @see #setHomeActionContentDescription(int)
876     */
877    public void setHomeAsUpIndicator(@Nullable Drawable indicator) {}
878
879    /**
880     * Set an alternate drawable to display next to the icon/logo/title
881     * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using
882     * this mode to display an alternate selection for up navigation, such as a sliding drawer.
883     *
884     * <p>If you pass <code>0</code> to this method, the default drawable from the theme
885     * will be used.</p>
886     *
887     * <p>If you implement alternate or intermediate behavior around Up, you should also
888     * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()}
889     * to provide a correct description of the action for accessibility support.</p>
890     *
891     * @param resId Resource ID of a drawable to use for the up indicator, or 0
892     *              to use the theme's default
893     *
894     * @see #setDisplayOptions(int, int)
895     * @see #setDisplayHomeAsUpEnabled(boolean)
896     * @see #setHomeActionContentDescription(int)
897     */
898    public void setHomeAsUpIndicator(@DrawableRes int resId) {}
899
900    /**
901     * Set an alternate description for the Home/Up action, when enabled.
902     *
903     * <p>This description is commonly used for accessibility/screen readers when
904     * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.)
905     * Examples of this are, "Navigate Home" or "Navigate Up" depending on the
906     * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up
907     * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific
908     * functionality such as a sliding drawer, you should also set this to accurately
909     * describe the action.</p>
910     *
911     * <p>Setting this to <code>null</code> will use the system default description.</p>
912     *
913     * @param description New description for the Home action when enabled
914     * @see #setHomeAsUpIndicator(int)
915     * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable)
916     */
917    public void setHomeActionContentDescription(@Nullable CharSequence description) {}
918
919    /**
920     * Set an alternate description for the Home/Up action, when enabled.
921     *
922     * <p>This description is commonly used for accessibility/screen readers when
923     * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.)
924     * Examples of this are, "Navigate Home" or "Navigate Up" depending on the
925     * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up
926     * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific
927     * functionality such as a sliding drawer, you should also set this to accurately
928     * describe the action.</p>
929     *
930     * <p>Setting this to <code>0</code> will use the system default description.</p>
931     *
932     * @param resId Resource ID of a string to use as the new description
933     *              for the Home action when enabled
934     * @see #setHomeAsUpIndicator(int)
935     * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable)
936     */
937    public void setHomeActionContentDescription(@StringRes int resId) {}
938
939    /**
940     * Enable hiding the action bar on content scroll.
941     *
942     * <p>If enabled, the action bar will scroll out of sight along with a
943     * {@link View#setNestedScrollingEnabled(boolean) nested scrolling child} view's content.
944     * The action bar must be in {@link Window#FEATURE_ACTION_BAR_OVERLAY overlay mode}
945     * to enable hiding on content scroll.</p>
946     *
947     * <p>When partially scrolled off screen the action bar is considered
948     * {@link #hide() hidden}. A call to {@link #show() show} will cause it to return to full view.
949     * </p>
950     * @param hideOnContentScroll true to enable hiding on content scroll.
951     */
952    public void setHideOnContentScrollEnabled(boolean hideOnContentScroll) {
953        if (hideOnContentScroll) {
954            throw new UnsupportedOperationException("Hide on content scroll is not supported in " +
955                    "this action bar configuration.");
956        }
957    }
958
959    /**
960     * Return whether the action bar is configured to scroll out of sight along with
961     * a {@link View#setNestedScrollingEnabled(boolean) nested scrolling child}.
962     *
963     * @return true if hide-on-content-scroll is enabled
964     * @see #setHideOnContentScrollEnabled(boolean)
965     */
966    public boolean isHideOnContentScrollEnabled() {
967        return false;
968    }
969
970    /**
971     * Return the current vertical offset of the action bar.
972     *
973     * <p>The action bar's current hide offset is the distance that the action bar is currently
974     * scrolled offscreen in pixels. The valid range is 0 (fully visible) to the action bar's
975     * current measured {@link #getHeight() height} (fully invisible).</p>
976     *
977     * @return The action bar's offset toward its fully hidden state in pixels
978     */
979    public int getHideOffset() {
980        return 0;
981    }
982
983    /**
984     * Set the current hide offset of the action bar.
985     *
986     * <p>The action bar's current hide offset is the distance that the action bar is currently
987     * scrolled offscreen in pixels. The valid range is 0 (fully visible) to the action bar's
988     * current measured {@link #getHeight() height} (fully invisible).</p>
989     *
990     * @param offset The action bar's offset toward its fully hidden state in pixels.
991     */
992    public void setHideOffset(int offset) {
993        if (offset != 0) {
994            throw new UnsupportedOperationException("Setting an explicit action bar hide offset " +
995                    "is not supported in this action bar configuration.");
996        }
997    }
998
999    /**
1000     * Set the Z-axis elevation of the action bar in pixels.
1001     *
1002     * <p>The action bar's elevation is the distance it is placed from its parent surface. Higher
1003     * values are closer to the user.</p>
1004     *
1005     * @param elevation Elevation value in pixels
1006     */
1007    public void setElevation(float elevation) {
1008        if (elevation != 0) {
1009            throw new UnsupportedOperationException("Setting a non-zero elevation is " +
1010                    "not supported in this action bar configuration.");
1011        }
1012    }
1013
1014    /**
1015     * Get the Z-axis elevation of the action bar in pixels.
1016     *
1017     * <p>The action bar's elevation is the distance it is placed from its parent surface. Higher
1018     * values are closer to the user.</p>
1019     *
1020     * @return Elevation value in pixels
1021     */
1022    public float getElevation() {
1023        return 0;
1024    }
1025
1026    /** @hide */
1027    public void setDefaultDisplayHomeAsUpEnabled(boolean enabled) {
1028    }
1029
1030    /** @hide */
1031    public void setShowHideAnimationEnabled(boolean enabled) {
1032    }
1033
1034    /** @hide */
1035    public void onConfigurationChanged(Configuration config) {
1036    }
1037
1038    /** @hide */
1039    public void dispatchMenuVisibilityChanged(boolean visible) {
1040    }
1041
1042    /** @hide */
1043    public ActionMode startActionMode(ActionMode.Callback callback) {
1044        return null;
1045    }
1046
1047    /** @hide */
1048    public boolean openOptionsMenu() {
1049        return false;
1050    }
1051
1052    /** @hide */
1053    public boolean invalidateOptionsMenu() {
1054        return false;
1055    }
1056
1057    /** @hide */
1058    public boolean onMenuKeyEvent(KeyEvent event) {
1059        return false;
1060    }
1061
1062    /** @hide **/
1063    public boolean onKeyShortcut(int keyCode, KeyEvent ev) {
1064        return false;
1065    }
1066
1067    /** @hide */
1068    public boolean collapseActionView() {
1069        return false;
1070    }
1071
1072    /** @hide */
1073    public void setWindowTitle(CharSequence title) {
1074    }
1075
1076    /**
1077     * Listener interface for ActionBar navigation events.
1078     *
1079     * @deprecated Action bar navigation modes are deprecated and not supported by inline
1080     * toolbar action bars. Consider using other
1081     * <a href="http://developer.android.com/design/patterns/navigation.html">common
1082     * navigation patterns</a> instead.
1083     */
1084    public interface OnNavigationListener {
1085        /**
1086         * This method is called whenever a navigation item in your action bar
1087         * is selected.
1088         *
1089         * @param itemPosition Position of the item clicked.
1090         * @param itemId ID of the item clicked.
1091         * @return True if the event was handled, false otherwise.
1092         */
1093        public boolean onNavigationItemSelected(int itemPosition, long itemId);
1094    }
1095
1096    /**
1097     * Listener for receiving events when action bar menus are shown or hidden.
1098     */
1099    public interface OnMenuVisibilityListener {
1100
1101        /**
1102         * Called when an action bar menu is shown or hidden. Applications may want to use
1103         * this to tune auto-hiding behavior for the action bar or pause/resume video playback,
1104         * gameplay, or other activity within the main content area.
1105         *
1106         * @param isVisible True if an action bar menu is now visible, false if no action bar
1107         *                  menus are visible.
1108         */
1109        public void onMenuVisibilityChanged(boolean isVisible);
1110    }
1111
1112    /**
1113     * A tab in the action bar.
1114     *
1115     * <p>Tabs manage the hiding and showing of {@link Fragment}s.
1116     *
1117     * @deprecated Action bar navigation modes are deprecated and not supported by inline
1118     * toolbar action bars. Consider using other
1119     * <a href="http://developer.android.com/design/patterns/navigation.html">common
1120     * navigation patterns</a> instead.
1121     */
1122    public static abstract class Tab {
1123
1124        /**
1125         * An invalid position for a tab.
1126         *
1127         * @see #getPosition()
1128         */
1129        public static final int INVALID_POSITION = -1;
1130
1131        /**
1132         * Return the current position of this tab in the action bar.
1133         *
1134         * @return Current position, or {@link #INVALID_POSITION} if this tab is not currently in
1135         *         the action bar.
1136         */
1137        public abstract int getPosition();
1138
1139        /**
1140         * Return the icon associated with this tab.
1141         *
1142         * @return The tab's icon
1143         */
1144        public abstract Drawable getIcon();
1145
1146        /**
1147         * Return the text of this tab.
1148         *
1149         * @return The tab's text
1150         */
1151        public abstract CharSequence getText();
1152
1153        /**
1154         * Set the icon displayed on this tab.
1155         *
1156         * @param icon The drawable to use as an icon
1157         * @return The current instance for call chaining
1158         */
1159        public abstract Tab setIcon(Drawable icon);
1160
1161        /**
1162         * Set the icon displayed on this tab.
1163         *
1164         * @param resId Resource ID referring to the drawable to use as an icon
1165         * @return The current instance for call chaining
1166         */
1167        public abstract Tab setIcon(@DrawableRes int resId);
1168
1169        /**
1170         * Set the text displayed on this tab. Text may be truncated if there is not
1171         * room to display the entire string.
1172         *
1173         * @param text The text to display
1174         * @return The current instance for call chaining
1175         */
1176        public abstract Tab setText(CharSequence text);
1177
1178        /**
1179         * Set the text displayed on this tab. Text may be truncated if there is not
1180         * room to display the entire string.
1181         *
1182         * @param resId A resource ID referring to the text that should be displayed
1183         * @return The current instance for call chaining
1184         */
1185        public abstract Tab setText(int resId);
1186
1187        /**
1188         * Set a custom view to be used for this tab. This overrides values set by
1189         * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}.
1190         *
1191         * @param view Custom view to be used as a tab.
1192         * @return The current instance for call chaining
1193         */
1194        public abstract Tab setCustomView(View view);
1195
1196        /**
1197         * Set a custom view to be used for this tab. This overrides values set by
1198         * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}.
1199         *
1200         * @param layoutResId A layout resource to inflate and use as a custom tab view
1201         * @return The current instance for call chaining
1202         */
1203        public abstract Tab setCustomView(int layoutResId);
1204
1205        /**
1206         * Retrieve a previously set custom view for this tab.
1207         *
1208         * @return The custom view set by {@link #setCustomView(View)}.
1209         */
1210        public abstract View getCustomView();
1211
1212        /**
1213         * Give this Tab an arbitrary object to hold for later use.
1214         *
1215         * @param obj Object to store
1216         * @return The current instance for call chaining
1217         */
1218        public abstract Tab setTag(Object obj);
1219
1220        /**
1221         * @return This Tab's tag object.
1222         */
1223        public abstract Object getTag();
1224
1225        /**
1226         * Set the {@link TabListener} that will handle switching to and from this tab.
1227         * All tabs must have a TabListener set before being added to the ActionBar.
1228         *
1229         * @param listener Listener to handle tab selection events
1230         * @return The current instance for call chaining
1231         */
1232        public abstract Tab setTabListener(TabListener listener);
1233
1234        /**
1235         * Select this tab. Only valid if the tab has been added to the action bar.
1236         */
1237        public abstract void select();
1238
1239        /**
1240         * Set a description of this tab's content for use in accessibility support.
1241         * If no content description is provided the title will be used.
1242         *
1243         * @param resId A resource ID referring to the description text
1244         * @return The current instance for call chaining
1245         * @see #setContentDescription(CharSequence)
1246         * @see #getContentDescription()
1247         */
1248        public abstract Tab setContentDescription(int resId);
1249
1250        /**
1251         * Set a description of this tab's content for use in accessibility support.
1252         * If no content description is provided the title will be used.
1253         *
1254         * @param contentDesc Description of this tab's content
1255         * @return The current instance for call chaining
1256         * @see #setContentDescription(int)
1257         * @see #getContentDescription()
1258         */
1259        public abstract Tab setContentDescription(CharSequence contentDesc);
1260
1261        /**
1262         * Gets a brief description of this tab's content for use in accessibility support.
1263         *
1264         * @return Description of this tab's content
1265         * @see #setContentDescription(CharSequence)
1266         * @see #setContentDescription(int)
1267         */
1268        public abstract CharSequence getContentDescription();
1269    }
1270
1271    /**
1272     * Callback interface invoked when a tab is focused, unfocused, added, or removed.
1273     *
1274     * @deprecated Action bar navigation modes are deprecated and not supported by inline
1275     * toolbar action bars. Consider using other
1276     * <a href="http://developer.android.com/design/patterns/navigation.html">common
1277     * navigation patterns</a> instead.
1278     */
1279    public interface TabListener {
1280
1281        /**
1282         * Called when a tab enters the selected state.
1283         *
1284         * @param tab The tab that was selected
1285         * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute
1286         *        during a tab switch. The previous tab's unselect and this tab's select will be
1287         *        executed in a single transaction. This FragmentTransaction does not support
1288         *        being added to the back stack.
1289         */
1290        public void onTabSelected(Tab tab, FragmentTransaction ft);
1291
1292        /**
1293         * Called when a tab exits the selected state.
1294         *
1295         * @param tab The tab that was unselected
1296         * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute
1297         *        during a tab switch. This tab's unselect and the newly selected tab's select
1298         *        will be executed in a single transaction. This FragmentTransaction does not
1299         *        support being added to the back stack.
1300         */
1301        public void onTabUnselected(Tab tab, FragmentTransaction ft);
1302
1303        /**
1304         * Called when a tab that is already selected is chosen again by the user.
1305         * Some applications may use this action to return to the top level of a category.
1306         *
1307         * @param tab The tab that was reselected.
1308         * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute
1309         *        once this method returns. This FragmentTransaction does not support
1310         *        being added to the back stack.
1311         */
1312        public void onTabReselected(Tab tab, FragmentTransaction ft);
1313    }
1314
1315    /**
1316     * Per-child layout information associated with action bar custom views.
1317     */
1318    public static class LayoutParams extends ViewGroup.MarginLayoutParams {
1319        /**
1320         * Gravity for the view associated with these LayoutParams.
1321         *
1322         * @see android.view.Gravity
1323         */
1324        public int gravity = Gravity.NO_GRAVITY;
1325
1326        public LayoutParams(@NonNull Context c, AttributeSet attrs) {
1327            super(c, attrs);
1328
1329            TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.ActionBarLayout);
1330            gravity = a.getInt(R.styleable.ActionBarLayout_android_layout_gravity, Gravity.NO_GRAVITY);
1331            a.recycle();
1332        }
1333
1334        public LayoutParams(int width, int height) {
1335            super(width, height);
1336            this.gravity = Gravity.CENTER_VERTICAL | GravityCompat.START;
1337        }
1338
1339        public LayoutParams(int width, int height, int gravity) {
1340            super(width, height);
1341            this.gravity = gravity;
1342        }
1343
1344        public LayoutParams(int gravity) {
1345            this(WRAP_CONTENT, MATCH_PARENT, gravity);
1346        }
1347
1348        public LayoutParams(LayoutParams source) {
1349            super(source);
1350
1351            this.gravity = source.gravity;
1352        }
1353
1354        public LayoutParams(ViewGroup.LayoutParams source) {
1355            super(source);
1356        }
1357    }
1358
1359    /**
1360     * Interface implemented by entities such as Activities that host action bars.
1361     */
1362    interface Callback {
1363
1364        FragmentManager getSupportFragmentManager();
1365    }
1366}
1367