ActionBar.java revision f4a93d160fc696de65e103e7e078106ea8f818fa
1bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell/* 2bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Copyright (C) 2012 The Android Open Source Project 3bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 4bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Licensed under the Apache License, Version 2.0 (the "License"); 5bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * you may not use this file except in compliance with the License. 6bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * You may obtain a copy of the License at 7bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 8bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * http://www.apache.org/licenses/LICENSE-2.0 9bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 10bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Unless required by applicable law or agreed to in writing, software 11bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * distributed under the License is distributed on an "AS IS" BASIS, 12bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * See the License for the specific language governing permissions and 14bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * limitations under the License. 15bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 16bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 17da10fdd1400ecfd8d7f2e55651dd528d0614dfc5Jeff Brownpackage android.support.v7.app; 18bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 19bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.content.Context; 20bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.content.res.TypedArray; 21bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.graphics.drawable.Drawable; 22b79bd8bd1afdf165068ddafdc5fa0667f7ec4a70Jeff Brownimport android.support.v4.app.Fragment; 23da10fdd1400ecfd8d7f2e55651dd528d0614dfc5Jeff Brownimport android.support.v4.app.FragmentManager; 24da10fdd1400ecfd8d7f2e55651dd528d0614dfc5Jeff Brownimport android.support.v4.app.FragmentTransaction; 25da10fdd1400ecfd8d7f2e55651dd528d0614dfc5Jeff Brownimport android.support.v7.appcompat.R; 26bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.util.AttributeSet; 27bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.view.Gravity; 28bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.view.View; 29bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.view.ViewGroup; 30bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.view.ViewGroup.MarginLayoutParams; 31bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.view.Window; 32bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellimport android.widget.SpinnerAdapter; 33bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 34bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell/** 35bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * A window feature at the top of the activity that may display the activity title, navigation 36bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * modes, and other interactive items. 3720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 389dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * <p class="note"><strong>Note:</strong> This class is included in the <a 399dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * href="{@docRoot}tools/extras/support-library.html">support library</a> for compatibility 409dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * with API level 7 and higher. If you're developing your app for API level 11 and higher 419dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * <em>only</em>, you should instead use the framework {@link android.app.ActionBar} class.</p> 429dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 439dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * <p>When using the support library, you can add the action bar to the top of your activity 449dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * window by extending the {@link ActionBarActivity} class and setting the activity theme to 459dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * {@link android.support.v7.appcompat.R.style#Theme_AppCompat Theme.AppCompat} or a similar theme. 4620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 47bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>By default, the action bar shows the application icon on 48bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * the left, followed by the activity title. If your activity has an options menu, you can make 49bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * select items accessible directly from the action bar as "action items". You can also 50bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * modify various characteristics of the action bar or remove it completely.</p> 5120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 52bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link 539dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * android.support.v7.app.ActionBarActivity#getSupportActionBar}.</p> 5420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 55bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>In some cases, the action bar may be overlayed by another bar that enables contextual actions, 569dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * using an {@link android.support.v7.view.ActionMode}. For example, when the user selects one or 579dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * more items in your activity, you can enable an action mode that offers actions specific to the 589dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * selected items, with a UI that temporarily replaces the action bar. Although the UI may occupy 599dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * the same space, the {@link android.support.v7.view.ActionMode} APIs are distinct and independent 609dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * from those for {@link ActionBar}. 6120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 62bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <div class="special reference"> 63bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <h3>Developer Guides</h3> 6420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 65bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>For information about how to use the action bar, including how to add action items, navigation 66bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * modes and more, read the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action 679dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * Bar</a> API guide.</p> 68bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * </div> 69bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 70bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powellpublic abstract class ActionBar { 7120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 72bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 7320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Standard navigation mode. Consists of either a logo or icon and title text with an optional 7420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * subtitle. Clicking any of these elements will dispatch onOptionsItemSelected to the host 7520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Activity with a MenuItem with item ID android.R.id.home. 76bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 77bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int NAVIGATION_MODE_STANDARD = 0; 78bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 79bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 8020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * List navigation mode. Instead of static title text this mode presents a list menu for 8120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * navigation within the activity. e.g. this might be presented to the user as a dropdown list. 82bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 83bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int NAVIGATION_MODE_LIST = 1; 84bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 85bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 8620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Tab navigation mode. Instead of static title text this mode presents a series of tabs for 8720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * navigation within the activity. 88bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 89bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int NAVIGATION_MODE_TABS = 2; 90bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 91bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 9220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Use logo instead of icon if available. This flag will cause appropriate navigation modes to 9320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * use a wider logo in place of the standard icon. 94bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 95bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 96bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 97bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 98bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_USE_LOGO = 0x1; 99bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 100bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 10120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Show 'home' elements in this action bar, leaving more space for other navigation elements. 10220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * This includes logo and icon. 103bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 104bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 105bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 106bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 107bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_SHOW_HOME = 0x2; 108bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 109bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 11020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Display the 'home' element such that it appears as an 'up' affordance. e.g. show an arrow to 11120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * the left indicating the action that will be taken. 112bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 11320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set this flag if selecting the 'home' button in the action bar to return up by a single level 11420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * in your UI rather than back to the top level or front page. 115bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 11620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>Setting this option will implicitly enable interaction with the home/up button. See {@link 11720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #setHomeButtonEnabled(boolean)}. 118bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 119bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 120bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 121bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 122bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_HOME_AS_UP = 0x4; 123bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 124bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 125bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Show the activity title and subtitle, if present. 126bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 127bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(CharSequence) 128bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(int) 129bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(CharSequence) 130bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(int) 131bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 132bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 133bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 134bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_SHOW_TITLE = 0x8; 135bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 136bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 137bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Show the custom view if one has been set. 13820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 139bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setCustomView(View) 140bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 141bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 142bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 143bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int DISPLAY_SHOW_CUSTOM = 0x10; 144bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 145bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 14620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the action bar into custom navigation mode, supplying a view for custom navigation. 147bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 14820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Custom navigation views appear between the application icon and any action buttons and may 14920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * use any space available there. Common use cases for custom navigation views might include an 15020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * auto-suggesting address bar for a browser or other navigation mechanisms that do not 151bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * translate well to provided navigation modes. 152bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 153bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param view Custom navigation view to place in the ActionBar. 154bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 155bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setCustomView(View view); 156bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 157bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 15820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the action bar into custom navigation mode, supplying a view for custom navigation. 159bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 16020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>Custom navigation views appear between the application icon and any action buttons and may 16120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * use any space available there. Common use cases for custom navigation views might include an 16220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * auto-suggesting address bar for a browser or other navigation mechanisms that do not 163bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * translate well to provided navigation modes.</p> 164bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 16520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for the custom view to be 16620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * displayed.</p> 167bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 16820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param view Custom navigation view to place in the ActionBar. 169bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param layoutParams How this custom view should layout in the bar. 170bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 171bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 172bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setCustomView(View view, LayoutParams layoutParams); 173bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 174bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 17520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the action bar into custom navigation mode, supplying a view for custom navigation. 176bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 17720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>Custom navigation views appear between the application icon and any action buttons and may 17820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * use any space available there. Common use cases for custom navigation views might include an 17920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * auto-suggesting address bar for a browser or other navigation mechanisms that do not 180bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * translate well to provided navigation modes.</p> 181bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 18220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for the custom view to be 18320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * displayed.</p> 184bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 185bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of a layout to inflate into the ActionBar. 186bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 187bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 188bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setCustomView(int resId); 189bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 190bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 19120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the icon to display in the 'home' section of the action bar. The action bar will use an 19220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * icon specified by its style or the activity icon by default. 193bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 19420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Whether the home section shows an icon or logo is controlled by the display option {@link 19520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #DISPLAY_USE_LOGO}. 196bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 197bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of a drawable to show as an icon. 198bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 199bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 200bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 201bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setIcon(int resId); 202bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 203bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 20420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the icon to display in the 'home' section of the action bar. The action bar will use an 20520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * icon specified by its style or the activity icon by default. 206bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 20720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Whether the home section shows an icon or logo is controlled by the display option {@link 20820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #DISPLAY_USE_LOGO}. 209bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 210bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param icon Drawable to show as an icon. 211bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 212bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 213bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 214bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setIcon(Drawable icon); 215bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 216bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 21720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the logo to display in the 'home' section of the action bar. The action bar will use a 21820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * logo specified by its style or the activity logo by default. 219bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 22020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Whether the home section shows an icon or logo is controlled by the display option {@link 22120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #DISPLAY_USE_LOGO}. 222bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 223bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of a drawable to show as a logo. 224bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 225bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 226bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 227bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setLogo(int resId); 228bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 229bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 23020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the logo to display in the 'home' section of the action bar. The action bar will use a 23120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * logo specified by its style or the activity logo by default. 232bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 23320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Whether the home section shows an icon or logo is controlled by the display option {@link 23420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #DISPLAY_USE_LOGO}. 235bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 236bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param logo Drawable to show as a logo. 237bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayUseLogoEnabled(boolean) 238bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayShowHomeEnabled(boolean) 239bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 240bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setLogo(Drawable logo); 241bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 242bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 243bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the adapter and navigation callback for list navigation mode. 244bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 24520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * The supplied adapter will provide views for the expanded list as well as the currently 24620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * selected item. (These may be displayed differently.) 247bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 24820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * The supplied OnNavigationListener will alert the application when the user changes the 24920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * current list selection. 250bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 25120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param adapter An adapter that will provide views both to display the current navigation 25220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * selection and populate views within the dropdown navigation menu. 25320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param callback An OnNavigationListener that will receive events when the user selects a 25420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * navigation item. 255bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 256bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setListNavigationCallbacks(SpinnerAdapter adapter, 257bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell OnNavigationListener callback); 258bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 259bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 260bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the selected navigation item in list or tabbed navigation modes. 261bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 262bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param position Position of the item to select. 263bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 264bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setSelectedNavigationItem(int position); 265bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 266bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 267bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Get the position of the selected navigation item in list or tabbed navigation modes. 268bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 269bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Position of the selected item. 270bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 271bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getSelectedNavigationIndex(); 272bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 273bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 274bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Get the number of navigation items present in the current navigation mode. 275bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 276bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Number of navigation items. 277bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 278bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getNavigationItemCount(); 279bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 280bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 28120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the action bar's title. This will only be displayed if {@link #DISPLAY_SHOW_TITLE} is 28220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * set. 283bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 284bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param title Title to set 285bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(int) 286bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 287bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 288bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setTitle(CharSequence title); 289bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 290bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 29120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the action bar's title. This will only be displayed if {@link #DISPLAY_SHOW_TITLE} is 29220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * set. 293bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 294bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of title string to set 295bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setTitle(CharSequence) 296bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 297bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 298bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setTitle(int resId); 299bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 300bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 30120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the action bar's subtitle. This will only be displayed if {@link #DISPLAY_SHOW_TITLE} is 30220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * set. Set to null to disable the subtitle entirely. 303bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 304bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param subtitle Subtitle to set 305bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(int) 306bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 307bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 308bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setSubtitle(CharSequence subtitle); 309bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 310bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 31120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the action bar's subtitle. This will only be displayed if {@link #DISPLAY_SHOW_TITLE} is 31220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * set. 313bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 314bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID of subtitle string to set 315bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSubtitle(CharSequence) 316bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 317bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 318bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setSubtitle(int resId); 319bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 320bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 32120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set display options. This changes all display option bits at once. To change a limited subset 32220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * of display options, see {@link #setDisplayOptions(int, int)}. 323bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 32420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param options A combination of the bits defined by the DISPLAY_ constants defined in 32520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * ActionBar. 326bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 327bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayOptions(int options); 328bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 329bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 33020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set selected display options. Only the options specified by mask will be changed. To change 33120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * all display option bits at once, see {@link #setDisplayOptions(int)}. 332bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 33320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>Example: setDisplayOptions(0, DISPLAY_SHOW_HOME) will disable the {@link 33420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #DISPLAY_SHOW_HOME} option. setDisplayOptions(DISPLAY_SHOW_HOME, DISPLAY_SHOW_HOME | 33520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * DISPLAY_USE_LOGO) will enable {@link #DISPLAY_SHOW_HOME} and disable {@link 33620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #DISPLAY_USE_LOGO}. 337bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 33820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param options A combination of the bits defined by the DISPLAY_ constants defined in 33920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * ActionBar. 34020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param mask A bit mask declaring which display options should be changed. 341bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 342bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayOptions(int options, int mask); 343bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 344bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 34520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set whether to display the activity logo rather than the activity icon. A logo is often a 34620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * wider, more detailed image. 347bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 348bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 349bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 350bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param useLogo true to use the activity logo, false to use the activity icon. 351bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 352bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 353bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 354bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayUseLogoEnabled(boolean useLogo); 355bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 356bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 35720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set whether to include the application home affordance in the action bar. Home is presented 35820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * as either an activity icon or logo. 359bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 360bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 361bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 362bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param showHome true to show home, false otherwise. 363bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 364bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 365bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 366bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayShowHomeEnabled(boolean showHome); 367bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 368bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 36920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set whether home should be displayed as an "up" affordance. Set this to true if selecting 37020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * "home" returns up by a single level in your UI rather than back to the top level or front 37120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * page. 372bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 373bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 374bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 37520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param showHomeAsUp true to show the user that selecting home will return one level up rather 37620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * than to the top level of the app. 377bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 378bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 379bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 380bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp); 381bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 382bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 383bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set whether an activity title/subtitle should be displayed. 384bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 385bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 386bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 387bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param showTitle true to display a title/subtitle if present. 388bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 389bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 390bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 391bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayShowTitleEnabled(boolean showTitle); 392bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 393bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 394bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set whether a custom view should be displayed, if set. 395bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 396bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>To set several display options at once, see the setDisplayOptions methods. 397bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 39820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param showCustom true if the currently set custom view should be displayed, false 39920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * otherwise. 400bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int) 401bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setDisplayOptions(int, int) 402bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 403bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setDisplayShowCustomEnabled(boolean showCustom); 404bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 405bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 40620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the ActionBar's background. This will be used for the primary action bar. 407bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 408bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param d Background drawable 409bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setStackedBackgroundDrawable(Drawable) 410bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setSplitBackgroundDrawable(Drawable) 411bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 412bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setBackgroundDrawable(Drawable d); 413bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 414bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 41520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the ActionBar's stacked background. This will appear in the second row/stacked bar on 41620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * some devices and configurations. 417bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 418bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param d Background drawable for the stacked row 419bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 42020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public void setStackedBackgroundDrawable(Drawable d) { 42120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns } 422bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 423bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 42420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the ActionBar's split background. This will appear in the split action bar containing 42520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * menu-provided action buttons on some devices and configurations 42620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 427bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>You can enable split action bar with {@link android.R.attr#uiOptions} 428bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 429bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param d Background drawable for the split bar 430bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 43120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public void setSplitBackgroundDrawable(Drawable d) { 43220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns } 433bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 434bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 435bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current custom view. 436bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 437bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract View getCustomView(); 438bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 439bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 44020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Returns the current ActionBar title in standard mode. Returns null if {@link 44120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #getNavigationMode()} would not return {@link #NAVIGATION_MODE_STANDARD}. 442bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 443bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current ActionBar title or null. 444bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 445bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getTitle(); 446bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 447bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 44820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Returns the current ActionBar subtitle in standard mode. Returns null if {@link 44920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #getNavigationMode()} would not return {@link #NAVIGATION_MODE_STANDARD}. 450bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 451bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current ActionBar subtitle or null. 452bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 453bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getSubtitle(); 454bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 455bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 456bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Returns the current navigation mode. The result will be one of: 45720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 45820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <ul><li>{@link 45920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #NAVIGATION_MODE_STANDARD}</li> 46020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 461bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <li>{@link #NAVIGATION_MODE_LIST}</li> 46220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 46320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <li>{@link #NAVIGATION_MODE_TABS}</li></ul> 464bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 465bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current navigation mode. 466bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 467bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getNavigationMode(); 468bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 469bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 470bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the current navigation mode. 471bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 472bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param mode The new mode to set. 473bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #NAVIGATION_MODE_STANDARD 474bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #NAVIGATION_MODE_LIST 475bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #NAVIGATION_MODE_TABS 476bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 477bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void setNavigationMode(int mode); 478bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 479bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 480bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current set of display options. 481bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 482bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getDisplayOptions(); 483bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 484bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 48520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Create and return a new {@link Tab}. This tab will not be included in the action bar until it 48620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * is added. 487bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 48820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>Very often tabs will be used to switch between {@link Fragment} objects. Here is a 48920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * typical implementation of such tabs:</p> 490bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 491bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentTabs.java 49220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * complete} 493bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 494bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return A new Tab 495bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #addTab(Tab) 496bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 497bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab newTab(); 498bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 499bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 50020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. If 50120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * this is the first tab to be added it will become the selected tab. 502bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 503bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab Tab to add 504bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 505bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab); 506bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 507bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 508bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 509bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 51020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param tab Tab to add 511bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param setSelected True if the added tab should become the selected tab. 512bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 513bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab, boolean setSelected); 514bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 515bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 516bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be inserted at 51720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <code>position</code>. If this is the first tab to be added it will become the selected tab. 518bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 51920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param tab The tab to add 520bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param position The new position of the tab 521bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 522bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab, int position); 523bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 524bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 525bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be insterted at 526bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <code>position</code>. 527bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 52820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param tab The tab to add 52920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param position The new position of the tab 530bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param setSelected True if the added tab should become the selected tab. 531bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 532bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addTab(Tab tab, int position, boolean setSelected); 533bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 534bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 53520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Remove a tab from the action bar. If the removed tab was selected it will be deselected and 53620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * another tab will be selected if present. 537bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 538bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab to remove 539bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 540bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeTab(Tab tab); 541bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 542bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 54320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Remove a tab from the action bar. If the removed tab was selected it will be deselected and 54420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * another tab will be selected if present. 545bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 546bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param position Position of the tab to remove 547bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 548bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeTabAt(int position); 549bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 550bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 551bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Remove all tabs from the action bar and deselect the current tab. 552bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 553bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeAllTabs(); 554bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 555bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 556bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Select the specified tab. If it is not a child of this action bar it will be added. 557bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 558bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * <p>Note: If you want to select by index, use {@link #setSelectedNavigationItem(int)}.</p> 559bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 560bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab Tab to select 561bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 562bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void selectTab(Tab tab); 563bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 564bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 56520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Returns the currently selected tab if in tabbed navigation mode and there is at least one tab 56620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * present. 567bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 568bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The currently selected tab or null 569bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 570bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab getSelectedTab(); 571bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 572bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 573bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Returns the tab at the specified index. 574bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 575bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param index Index value in the range 0-get 576bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 577bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab getTabAt(int index); 578bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 579bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 580bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Returns the number of tabs currently registered with the action bar. 58120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * 582bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Tab count 583bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 584bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getTabCount(); 585bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 586bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 587bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Retrieve the current height of the ActionBar. 588bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 589bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The ActionBar's height 590bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 591bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getHeight(); 592bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 593bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 59420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Show the ActionBar if it is not currently showing. If the window hosting the ActionBar does 59520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * not have the feature {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 596bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * content to fit the new space available. 597bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 59820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>If you are hiding the ActionBar through {@link View#SYSTEM_UI_FLAG_FULLSCREEN 59920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * View.SYSTEM_UI_FLAG_FULLSCREEN}, you should not call this function directly. 600bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 601bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void show(); 602bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 603bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 60420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Hide the ActionBar if it is currently showing. If the window hosting the ActionBar does not 60520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * have the feature {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application content 60620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * to fit the new space available. 607bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 60820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>Instead of calling this function directly, you can also cause an ActionBar using the 60920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * overlay feature to hide through {@link View#SYSTEM_UI_FLAG_FULLSCREEN 61020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * View.SYSTEM_UI_FLAG_FULLSCREEN}. Hiding the ActionBar through this system UI flag allows you 61120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * to more seamlessly hide it in conjunction with other screen decorations. 612bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 613bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void hide(); 614bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 615bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 616bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return <code>true</code> if the ActionBar is showing, <code>false</code> otherwise. 617bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 618bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract boolean isShowing(); 619bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 620bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 621bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Add a listener that will respond to menu visibility change events. 622bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 623bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param listener The new listener to add 624bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 625bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void addOnMenuVisibilityListener(OnMenuVisibilityListener listener); 626bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 627bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 62820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Remove a menu visibility listener. This listener will no longer receive menu visibility 62920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * change events. 630bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 631bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param listener A listener to remove that was previously added 632bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 633bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener); 634bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 635bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 63620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Enable or disable the "home" button in the corner of the action bar. (Note that this is the 63720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * application home/up affordance on the action bar, not the systemwide home button.) 638bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 63920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>This defaults to true for packages targeting < API 14. For packages targeting API 14 or 64020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * greater, the application should call this method to enable interaction with the home/up 64120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * affordance. 642bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 64320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * <p>Setting the {@link #DISPLAY_HOME_AS_UP} display option will automatically enable the home 64420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * button. 645bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 646bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param enabled true to enable the home button, false to disable the home button. 647bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 64820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public void setHomeButtonEnabled(boolean enabled) { 64920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns } 650bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 651bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 65220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Returns a {@link Context} with an appropriate theme for creating views that will appear in 65320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * the action bar. If you are inflating or instantiating custom views that will appear in an 65420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * action bar, you should use the Context returned by this method. (This includes adapters used 65520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * for list navigation mode.) This will ensure that views contrast properly against the action 65620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * bar. 657bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 658bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return A themed Context for creating views 659bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 66020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns public Context getThemedContext() { 66120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns return null; 66220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns } 663bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 664bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 665f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate drawable to display next to the icon/logo/title 666f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using 667f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * this mode to display an alternate selection for up navigation, such as a sliding drawer. 668f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 669f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>If you pass <code>null</code> to this method, the default drawable from the theme 670f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * will be used.</p> 671f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 672f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>If you implement alternate or intermediate behavior around Up, you should also 673f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} 674f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * to provide a correct description of the action for accessibility support.</p> 675f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 676f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @param indicator A drawable to use for the up indicator, or null to use the theme's default 677f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 678f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayOptions(int, int) 679f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayHomeAsUpEnabled(boolean) 680f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeActionContentDescription(int) 681f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 682f4a93d160fc696de65e103e7e078106ea8f818faChris Banes public void setHomeAsUpIndicator(Drawable indicator) {} 683f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 684f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 685f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate drawable to display next to the icon/logo/title 686f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using 687f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * this mode to display an alternate selection for up navigation, such as a sliding drawer. 688f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 689f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>If you pass <code>0</code> to this method, the default drawable from the theme 690f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * will be used.</p> 691f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 692f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>If you implement alternate or intermediate behavior around Up, you should also 693f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} 694f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * to provide a correct description of the action for accessibility support.</p> 695f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 696f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @param resId Resource ID of a drawable to use for the up indicator, or null 697f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * to use the theme's default 698f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 699f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayOptions(int, int) 700f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setDisplayHomeAsUpEnabled(boolean) 701f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeActionContentDescription(int) 702f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 703f4a93d160fc696de65e103e7e078106ea8f818faChris Banes public void setHomeAsUpIndicator(int resId) {} 704f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 705f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 706f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate description for the Home/Up action, when enabled. 707f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 708f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>This description is commonly used for accessibility/screen readers when 709f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 710f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 711f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 712f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 713f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * functionality such as a sliding drawer, you should also set this to accurately 714f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * describe the action.</p> 715f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 716f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>Setting this to <code>null</code> will use the system default description.</p> 717f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 718f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @param description New description for the Home action when enabled 719f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeAsUpIndicator(int) 720f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 721f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 722f4a93d160fc696de65e103e7e078106ea8f818faChris Banes public void setHomeActionContentDescription(CharSequence description) {} 723f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 724f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 725f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Set an alternate description for the Home/Up action, when enabled. 726f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 727f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>This description is commonly used for accessibility/screen readers when 728f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) 729f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * Examples of this are, "Navigate Home" or "Navigate Up" depending on the 730f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up 731f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific 732f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * functionality such as a sliding drawer, you should also set this to accurately 733f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * describe the action.</p> 734f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 735f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * <p>Setting this to <code>0</code> will use the system default description.</p> 736f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * 737f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @param resId Resource ID of a string to use as the new description 738f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * for the Home action when enabled 739f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeAsUpIndicator(int) 740f4a93d160fc696de65e103e7e078106ea8f818faChris Banes * @see #setHomeAsUpIndicator(android.graphics.drawable.Drawable) 741f4a93d160fc696de65e103e7e078106ea8f818faChris Banes */ 742f4a93d160fc696de65e103e7e078106ea8f818faChris Banes public void setHomeActionContentDescription(int resId) {} 743f4a93d160fc696de65e103e7e078106ea8f818faChris Banes 744f4a93d160fc696de65e103e7e078106ea8f818faChris Banes /** 7459dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * Listener for receiving {@link ActionBar} navigation events. 7469dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 7479dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * <p class="note"><strong>Note:</strong> This interface is included in the <a 7489dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * href="{@docRoot}tools/extras/support-library.html">support library</a> for compatibility 7499dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * with API level 7 and higher. If you're developing your app for API level 11 and higher 7509dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * <em>only</em>, you should instead use the framework {@link 7519dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * android.app.ActionBar.OnNavigationListener} interface.</p> 752bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 753bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public interface OnNavigationListener { 75420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 755bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 75620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * This method is called whenever a navigation item in your action bar is selected. 757bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 758bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param itemPosition Position of the item clicked. 75920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param itemId ID of the item clicked. 760bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return True if the event was handled, false otherwise. 761bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 762bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public boolean onNavigationItemSelected(int itemPosition, long itemId); 763bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 764bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 765bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 7669dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * Listener for receiving events when {@link ActionBar} items are shown or hidden. 7679dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 7689dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * <p class="note"><strong>Note:</strong> This interface is included in the <a 7699dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * href="{@docRoot}tools/extras/support-library.html">support library</a> for compatibility 7709dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * with API level 7 and higher. If you're developing your app for API level 11 and higher 7719dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * <em>only</em>, you should instead use the framework {@link 7729dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * android.app.ActionBar.OnMenuVisibilityListener} interface.</p> 773bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 774bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public interface OnMenuVisibilityListener { 77520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 776bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 77720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Called when an action bar menu is shown or hidden. Applications may want to use this to 77820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * tune auto-hiding behavior for the action bar or pause/resume video playback, gameplay, or 77920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * other activity within the main content area. 780bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 78120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param isVisible True if an action bar menu is now visible, false if no action bar menus 78220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * are visible. 783bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 784bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onMenuVisibilityChanged(boolean isVisible); 785bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 786bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 787bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 7889dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * A tab in the action bar that manages the hiding and showing of {@link Fragment}s. 7899dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 7909dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * <p class="note"><strong>Note:</strong> This class is included in the <a 7919dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * href="{@docRoot}tools/extras/support-library.html">support library</a> for compatibility 7929dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * with API level 7 and higher. If you're developing your app for API level 11 and higher 7939dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * <em>only</em>, you should instead use the framework {@link android.app.ActionBar.Tab} 7949dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * class.</p> 795bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 7969dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * <div class="special reference"> 7979dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * <h3>Developer Guides</h3> 7989dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 7999dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * <p>For information about how to use action bar tabs, 8009dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * read the <a href="{@docRoot}guide/topics/ui/actionbar.html#Tabs">Action 8019dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * Bar</a> API guide.</p> 8029dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * </div> 803bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 804bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static abstract class Tab { 80520ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 806bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 807bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * An invalid position for a tab. 808bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 809bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #getPosition() 810bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 811bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static final int INVALID_POSITION = -1; 812bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 813bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 814bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Return the current position of this tab in the action bar. 815bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 816bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Current position, or {@link #INVALID_POSITION} if this tab is not currently in 817bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * the action bar. 818bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 819bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract int getPosition(); 820bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 821bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 822bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Return the icon associated with this tab. 823bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 824bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The tab's icon 825bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 826bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Drawable getIcon(); 827bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 828bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 829bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Return the text of this tab. 830bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 831bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The tab's text 832bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 833bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getText(); 834bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 835bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 836bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the icon displayed on this tab. 837bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 838bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param icon The drawable to use as an icon 839bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 840bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 841bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setIcon(Drawable icon); 842bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 843bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 844bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Set the icon displayed on this tab. 845bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 846bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId Resource ID referring to the drawable to use as an icon 847bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 848bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 849bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setIcon(int resId); 850bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 851bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 85220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the text displayed on this tab. Text may be truncated if there is not room to display 85320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * the entire string. 854bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 855bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param text The text to display 856bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 857bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 858bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setText(CharSequence text); 859bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 860bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 86120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the text displayed on this tab. Text may be truncated if there is not room to display 86220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * the entire string. 863bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 864bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId A resource ID referring to the text that should be displayed 865bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 866bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 867bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setText(int resId); 868bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 869bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 87020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set a custom view to be used for this tab. This overrides values set by {@link 87120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #setText(CharSequence)} and {@link #setIcon(Drawable)}. 872bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 873bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param view Custom view to be used as a tab. 874bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 875bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 876bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setCustomView(View view); 877bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 878bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 87920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set a custom view to be used for this tab. This overrides values set by {@link 88020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * #setText(CharSequence)} and {@link #setIcon(Drawable)}. 881bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 882bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param layoutResId A layout resource to inflate and use as a custom tab view 883bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 884bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 885bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setCustomView(int layoutResId); 886bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 887bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 888bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Retrieve a previously set custom view for this tab. 889bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 890bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The custom view set by {@link #setCustomView(View)}. 891bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 892bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract View getCustomView(); 893bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 894bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 895bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Give this Tab an arbitrary object to hold for later use. 896bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 897bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param obj Object to store 898bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 899bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 900bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setTag(Object obj); 901bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 902bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 903bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return This Tab's tag object. 904bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 905bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Object getTag(); 906bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 907bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 90820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set the {@link TabListener} that will handle switching to and from this tab. All tabs 90920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * must have a TabListener set before being added to the ActionBar. 910bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 911bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param listener Listener to handle tab selection events 912bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 913bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 914bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setTabListener(TabListener listener); 915bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 916bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 917bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Select this tab. Only valid if the tab has been added to the action bar. 918bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 919bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract void select(); 920bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 921bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 92220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set a description of this tab's content for use in accessibility support. If no content 92320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * description is provided the title will be used. 924bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 925bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param resId A resource ID referring to the description text 926bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 927bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(CharSequence) 928bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #getContentDescription() 929bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 930bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setContentDescription(int resId); 931bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 932bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 93320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Set a description of this tab's content for use in accessibility support. If no content 93420ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * description is provided the title will be used. 935bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 936bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param contentDesc Description of this tab's content 937bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return The current instance for call chaining 938bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(int) 939bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #getContentDescription() 940bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 941bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract Tab setContentDescription(CharSequence contentDesc); 942bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 943bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 944bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Gets a brief description of this tab's content for use in accessibility support. 945bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 946bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @return Description of this tab's content 947bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(CharSequence) 948bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see #setContentDescription(int) 949bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 950bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public abstract CharSequence getContentDescription(); 951bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 952bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 953bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 9549dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * Callback interface invoked when an {@link ActionBar.Tab} is focused, unfocused, added, or 9559dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * removed. 9569dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 9579dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * <p class="note"><strong>Note:</strong> This interface is included in the <a 9589dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * href="{@docRoot}tools/extras/support-library.html">support library</a> for compatibility 9599dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * with API level 7 and higher. If you're developing your app for API level 11 and higher 9609dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * <em>only</em>, you should instead use the framework {@link android.app.ActionBar.TabListener} 9619dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * interface.</p> 9629dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 9639dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * <div class="special reference"> 9649dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * <h3>Developer Guides</h3> 9659dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * 9669dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * <p>For information about how to use action bar tabs, 9679dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * read the <a href="{@docRoot}guide/topics/ui/actionbar.html#Tabs">Action 9689dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * Bar</a> API guide.</p> 9699dcd2e58138ca4eb4b18f80b50e8979329e859d6Scott Main * </div> 970bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 971bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public interface TabListener { 97220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 973bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 974bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Called when a tab enters the selected state. 975bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 976bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab that was selected 97720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 97820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * during a tab switch. The previous tab's unselect and this tab's select will be 97920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * executed in a single transaction. This FragmentTransaction does not support 98020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * being added to the back stack. 981bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 982bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onTabSelected(Tab tab, FragmentTransaction ft); 983bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 984bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 985bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Called when a tab exits the selected state. 986bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 987bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab that was unselected 98820ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 98920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * during a tab switch. This tab's unselect and the newly selected tab's select 99020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * will be executed in a single transaction. This FragmentTransaction does not 99120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * support being added to the back stack. 992bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 993bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onTabUnselected(Tab tab, FragmentTransaction ft); 994bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 995bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 99620ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * Called when a tab that is already selected is chosen again by the user. Some applications 99720ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * may use this action to return to the top level of a category. 998bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 999bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @param tab The tab that was reselected. 100020ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute once 100120ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * this method returns. This FragmentTransaction does not support being added to 100220ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns * the back stack. 1003bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1004bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public void onTabReselected(Tab tab, FragmentTransaction ft); 1005bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1006bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1007bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1008bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Per-child layout information associated with action bar custom views. 1009bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1010bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @attr ref android.R.styleable#ActionBar_LayoutParams_layout_gravity 1011bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1012bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public static class LayoutParams extends MarginLayoutParams { 101320ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 1014bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1015bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Gravity for the view associated with these LayoutParams. 1016bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * 1017bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * @see android.view.Gravity 1018bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1019bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public int gravity = -1; 1020bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1021bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(Context c, AttributeSet attrs) { 1022bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(c, attrs); 1023bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1024bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell TypedArray a = c.obtainStyledAttributes(attrs, 1025bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell R.styleable.ActionBarLayout); 1026bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell gravity = a.getInt(R.styleable.ActionBarLayout_android_layout_gravity, -1); 1027bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell a.recycle(); 1028bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1029bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1030bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(int width, int height) { 1031bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(width, height); 1032bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell this.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT; 1033bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1034bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1035bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(int width, int height, int gravity) { 1036bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(width, height); 1037bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell this.gravity = gravity; 1038bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1039bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1040bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(int gravity) { 1041bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell this(WRAP_CONTENT, FILL_PARENT, gravity); 1042bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1043bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1044bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(LayoutParams source) { 1045bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(source); 1046bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1047bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell this.gravity = source.gravity; 1048bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1049bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1050bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell public LayoutParams(ViewGroup.LayoutParams source) { 1051bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell super(source); 1052bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1053bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1054bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell 1055bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell /** 1056bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell * Interface implemented by entities such as Activities that host action bars. 1057bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell */ 1058bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell interface Callback { 105920ac724a3a836bfd362c911f7dc55a61c02b4d44Trevor Johns 1060bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell FragmentManager getSupportFragmentManager(); 1061bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell } 1062bbbb8f39d1b1d1b317c5f9237f20fe6b1d9eb17fAdam Powell} 1063