ActionBar.java revision 0c24a5514c1ff143a223720a090b19a86a75945f
133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell/* 233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Copyright (C) 2010 The Android Open Source Project 333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Licensed under the Apache License, Version 2.0 (the "License"); 533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * you may not use this file except in compliance with the License. 633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * You may obtain a copy of the License at 733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * http://www.apache.org/licenses/LICENSE-2.0 933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 1033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Unless required by applicable law or agreed to in writing, software 1133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * distributed under the License is distributed on an "AS IS" BASIS, 1233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * See the License for the specific language governing permissions and 1433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * limitations under the License. 1533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 1633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 1733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellpackage android.app; 1833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 199ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.app.ActionBar.Tab; 209ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.content.Context; 219ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.content.res.TypedArray; 2233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellimport android.graphics.drawable.Drawable; 239ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.util.AttributeSet; 249ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.Gravity; 2533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellimport android.view.View; 269ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.ViewDebug; 279ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.ViewGroup; 289ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powellimport android.view.ViewGroup.MarginLayoutParams; 296b336f835d637853800b94689375a03f337139a4Adam Powellimport android.view.Window; 30a408291e22def5755559f42cde913706a6d628c0Adam Powellimport android.widget.SpinnerAdapter; 3133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 3233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell/** 3333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * This is the public interface to the contextual ActionBar. 3433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * The ActionBar acts as a replacement for the title bar in Activities. 3533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * It provides facilities for creating toolbar actions as well as 3633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * methods of navigating around an application. 3733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 3833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powellpublic abstract class ActionBar { 39a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell /** 40a408291e22def5755559f42cde913706a6d628c0Adam Powell * Standard navigation mode. Consists of either a logo or icon 41a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * and title text with an optional subtitle. Clicking any of these elements 42a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * will dispatch onActionItemSelected to the registered Callback with 43a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * a MenuItem with item ID android.R.id.home. 44a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell */ 45a408291e22def5755559f42cde913706a6d628c0Adam Powell public static final int NAVIGATION_MODE_STANDARD = 0; 4633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 4733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 489ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * List navigation mode. Instead of static title text this mode 499ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * presents a list menu for navigation within the activity. 509ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * e.g. this might be presented to the user as a dropdown list. 5133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 529ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int NAVIGATION_MODE_LIST = 1; 539ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 549ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 559ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @deprecated use NAVIGATION_MODE_LIST 569ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 579ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @Deprecated 5833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public static final int NAVIGATION_MODE_DROPDOWN_LIST = 1; 5933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 6033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 6133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Tab navigation mode. Instead of static title text this mode 6233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * presents a series of tabs for navigation within the activity. 6333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 6433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public static final int NAVIGATION_MODE_TABS = 2; 6533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 6633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 6733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Use logo instead of icon if available. This flag will cause appropriate 6833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * navigation modes to use a wider logo in place of the standard icon. 699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 719ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 7233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 7333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public static final int DISPLAY_USE_LOGO = 0x1; 7433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 7533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 769ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show 'home' elements in this action bar, leaving more space for other 7733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * navigation elements. This includes logo and icon. 789ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 799ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 809ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_HOME = 0x2; 839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @deprecated Display flags are now positive for consistency - 'show' instead of 'hide'. 869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Use DISPLAY_SHOW_HOME. 879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @Deprecated 899ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_HIDE_HOME = 0x1000; 909ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 919ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 929ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Display the 'home' element such that it appears as an 'up' affordance. 939ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * e.g. show an arrow to the left indicating the action that will be taken. 949ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 959ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set this flag if selecting the 'home' button in the action bar to return 969ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * up by a single level in your UI rather than back to the top level or front page. 979ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 989ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 999ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1009ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1019ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_HOME_AS_UP = 0x4; 1029ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1039ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1049ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show the activity title and subtitle, if present. 1059ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1069ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setTitle(CharSequence) 1079ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setTitle(int) 1089ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setSubtitle(CharSequence) 1099ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setSubtitle(int) 1109ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1119ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1129ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1139ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_TITLE = 0x8; 1149ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Show the custom view if one has been set. 1179ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setCustomView(View) 1189ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int) 1199ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #setDisplayOptions(int, int) 1209ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1219ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static final int DISPLAY_SHOW_CUSTOM = 0x10; 1229ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1239ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1249ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the action bar into custom navigation mode, supplying a view 1259ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * for custom navigation. 1269ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1279ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Custom navigation views appear between the application icon and 1289ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * any action buttons and may use any space available there. Common 1299ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * use cases for custom navigation views might include an auto-suggesting 1309ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * address bar for a browser or other navigation mechanisms that do not 1319ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * translate well to provided navigation modes. 1329ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1339ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param view Custom navigation view to place in the ActionBar. 13433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 1359ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setCustomView(View view); 13689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell 13733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 138a408291e22def5755559f42cde913706a6d628c0Adam Powell * Set the action bar into custom navigation mode, supplying a view 139a408291e22def5755559f42cde913706a6d628c0Adam Powell * for custom navigation. 14033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 14133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Custom navigation views appear between the application icon and 14233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * any action buttons and may use any space available there. Common 143a408291e22def5755559f42cde913706a6d628c0Adam Powell * use cases for custom navigation views might include an auto-suggesting 144a408291e22def5755559f42cde913706a6d628c0Adam Powell * address bar for a browser or other navigation mechanisms that do not 145a408291e22def5755559f42cde913706a6d628c0Adam Powell * translate well to provided navigation modes. 14633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 14733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param view Custom navigation view to place in the ActionBar. 1489ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param layoutParams How this custom view should layout in the bar. 14933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 1509ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setCustomView(View view, LayoutParams layoutParams); 1519ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1529ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 1539ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param view 1549ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @deprecated Use {@link #setCustomView(View)} and {@link #setDisplayOptions(int)} instead. 1559ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1569ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @Deprecated 157a408291e22def5755559f42cde913706a6d628c0Adam Powell public abstract void setCustomNavigationMode(View view); 15833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 15933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 160a408291e22def5755559f42cde913706a6d628c0Adam Powell * Set the action bar into dropdown navigation mode and supply an adapter 161a408291e22def5755559f42cde913706a6d628c0Adam Powell * that will provide views for navigation choices. 16233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 163a408291e22def5755559f42cde913706a6d628c0Adam Powell * @param adapter An adapter that will provide views both to display 164a408291e22def5755559f42cde913706a6d628c0Adam Powell * the current navigation selection and populate views 165a408291e22def5755559f42cde913706a6d628c0Adam Powell * within the dropdown navigation menu. 16689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @param callback A NavigationCallback that will receive events when the user 16789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * selects a navigation item. 1689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @deprecated See setListNavigationCallbacks. 16933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 1709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @Deprecated 17189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell public abstract void setDropdownNavigationMode(SpinnerAdapter adapter, 17289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell NavigationCallback callback); 173a408291e22def5755559f42cde913706a6d628c0Adam Powell 17433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 1759ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the adapter and navigation callback for list navigation mode. 1769ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1779ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * The supplied adapter will provide views for the expanded list as well as 1789ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * the currently selected item. (These may be displayed differently.) 1799ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1809ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * The supplied NavigationCallback will alert the application when the user 1819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * changes the current list selection. 1829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 1839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param adapter An adapter that will provide views both to display 1849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * the current navigation selection and populate views 1859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * within the dropdown navigation menu. 1869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param callback A NavigationCallback that will receive events when the user 1879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * selects a navigation item. 1889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 1899ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setListNavigationCallbacks(SpinnerAdapter adapter, 1909ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell NavigationCallback callback); 1919ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 1929ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 193178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * Set the action bar into dropdown navigation mode and supply an adapter that will 194178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * provide views for navigation choices. 195178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * 196178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * @param adapter An adapter that will provide views both to display the current 197178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * navigation selection and populate views within the dropdown 198178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * navigation menu. 199178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * @param callback A NavigationCallback that will receive events when the user 200178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * selects a navigation item. 201178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * @param defaultSelectedPosition Position within the provided adapter that should be 202178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * selected from the outset. 2039ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @deprecated See setListNavigationCallbacks and setSelectedNavigationItem. 204178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell */ 2059ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @Deprecated 206178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell public abstract void setDropdownNavigationMode(SpinnerAdapter adapter, 207178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell NavigationCallback callback, int defaultSelectedPosition); 208178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell 209178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell /** 2109ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the selected navigation item in list or tabbed navigation modes. 211178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * 212178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * @param position Position of the item to select. 213178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell */ 214178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell public abstract void setSelectedNavigationItem(int position); 215178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell 216178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell /** 2179ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Get the position of the selected navigation item in list or tabbed navigation modes. 218178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * 219178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell * @return Position of the selected item. 2209ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @deprecated Use {@link #getSelectedNavigationIndex()} instead. 221178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell */ 2229ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @Deprecated 223178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell public abstract int getSelectedNavigationItem(); 224178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell 225178097727fab0f41810b1ffd4baf84ff8ed32c42Adam Powell /** 2269ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Get the position of the selected navigation item in list or tabbed navigation modes. 2279ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 2289ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return Position of the selected item. 2299ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 2309ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract int getSelectedNavigationIndex(); 2319ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 2329ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 2339ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Get the number of navigation items present in the current navigation mode. 2349ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 2359ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return Number of navigation items. 2369ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 2379ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract int getNavigationItemCount(); 2389ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 2399ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 2400e94b5151d817e600a888448a662208b29b5ef46Adam Powell * Set the action bar into standard navigation mode, using the currently set title 2410e94b5151d817e600a888448a662208b29b5ef46Adam Powell * and/or subtitle. 2420e94b5151d817e600a888448a662208b29b5ef46Adam Powell * 2430e94b5151d817e600a888448a662208b29b5ef46Adam Powell * Standard navigation mode is default. The title is automatically set to the name of 2440e94b5151d817e600a888448a662208b29b5ef46Adam Powell * your Activity on startup if an action bar is present. 2459ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @deprecated See setNavigationMode 2460e94b5151d817e600a888448a662208b29b5ef46Adam Powell */ 2479ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @Deprecated 2480e94b5151d817e600a888448a662208b29b5ef46Adam Powell public abstract void setStandardNavigationMode(); 2490e94b5151d817e600a888448a662208b29b5ef46Adam Powell 2500e94b5151d817e600a888448a662208b29b5ef46Adam Powell /** 2510e94b5151d817e600a888448a662208b29b5ef46Adam Powell * Set the action bar's title. This will only be displayed in standard navigation mode. 2520e94b5151d817e600a888448a662208b29b5ef46Adam Powell * 2530e94b5151d817e600a888448a662208b29b5ef46Adam Powell * @param title Title to set 254a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 255a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setTitle(int) 2560e94b5151d817e600a888448a662208b29b5ef46Adam Powell */ 2570e94b5151d817e600a888448a662208b29b5ef46Adam Powell public abstract void setTitle(CharSequence title); 2580e94b5151d817e600a888448a662208b29b5ef46Adam Powell 2590e94b5151d817e600a888448a662208b29b5ef46Adam Powell /** 260a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * Set the action bar's title. This will only be displayed in standard navigation mode. 261a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 262a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @param resId Resource ID of title string to set 263a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 264a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setTitle(CharSequence) 265a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell */ 266a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell public abstract void setTitle(int resId); 267a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell 268a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell /** 2690e94b5151d817e600a888448a662208b29b5ef46Adam Powell * Set the action bar's subtitle. This will only be displayed in standard navigation mode. 2700e94b5151d817e600a888448a662208b29b5ef46Adam Powell * Set to null to disable the subtitle entirely. 2710e94b5151d817e600a888448a662208b29b5ef46Adam Powell * 2720e94b5151d817e600a888448a662208b29b5ef46Adam Powell * @param subtitle Subtitle to set 273a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 274a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setSubtitle(int) 2750e94b5151d817e600a888448a662208b29b5ef46Adam Powell */ 2760e94b5151d817e600a888448a662208b29b5ef46Adam Powell public abstract void setSubtitle(CharSequence subtitle); 2770e94b5151d817e600a888448a662208b29b5ef46Adam Powell 2780e94b5151d817e600a888448a662208b29b5ef46Adam Powell /** 279a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * Set the action bar's subtitle. This will only be displayed in standard navigation mode. 280a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 281a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @param resId Resource ID of subtitle string to set 282a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * 283a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell * @see #setSubtitle(CharSequence) 284a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell */ 285a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell public abstract void setSubtitle(int resId); 286a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell 287a66c7b04567a584d73bc4dba2711f5d815e4932dAdam Powell /** 288a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * Set display options. This changes all display option bits at once. To change 289a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * a limited subset of display options, see {@link #setDisplayOptions(int, int)}. 29033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 29133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param options A combination of the bits defined by the DISPLAY_ constants 29233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * defined in ActionBar. 29333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 29433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract void setDisplayOptions(int options); 29533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 29633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 297a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * Set selected display options. Only the options specified by mask will be changed. 298a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * To change all display option bits at once, see {@link #setDisplayOptions(int)}. 299a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * 3009ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <p>Example: setDisplayOptions(0, DISPLAY_SHOW_HOME) will disable the 3019ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * {@link #DISPLAY_SHOW_HOME} option. 3025ad7af6fc764f71765b134b8cd51787a7e78753aBen Komalo * setDisplayOptions(DISPLAY_SHOW_HOME, DISPLAY_SHOW_HOME | DISPLAY_USE_LOGO) 3039ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * will enable {@link #DISPLAY_SHOW_HOME} and disable {@link #DISPLAY_USE_LOGO}. 304a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * 305a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * @param options A combination of the bits defined by the DISPLAY_ constants 306a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * defined in ActionBar. 307a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell * @param mask A bit mask declaring which display options should be changed. 308a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell */ 309a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell public abstract void setDisplayOptions(int options, int mask); 310a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell 311a1700783b52c3f4e6b52ea425cdce93c74936586Adam Powell /** 31233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * Set the ActionBar's background. 31333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * 31433b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @param d Background drawable 31533b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 31633b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract void setBackgroundDrawable(Drawable d); 31733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 31833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 31933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @return The current custom navigation view. 32033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 32133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract View getCustomNavigationView(); 32233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 32333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 324a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current ActionBar title in standard mode. 325a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns null if {@link #getNavigationMode()} would not return 326a408291e22def5755559f42cde913706a6d628c0Adam Powell * {@link #NAVIGATION_MODE_STANDARD}. 327a408291e22def5755559f42cde913706a6d628c0Adam Powell * 328a408291e22def5755559f42cde913706a6d628c0Adam Powell * @return The current ActionBar title or null. 32933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 33033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract CharSequence getTitle(); 33133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 33233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 333a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current ActionBar subtitle in standard mode. 334a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns null if {@link #getNavigationMode()} would not return 335a408291e22def5755559f42cde913706a6d628c0Adam Powell * {@link #NAVIGATION_MODE_STANDARD}. 336a408291e22def5755559f42cde913706a6d628c0Adam Powell * 337a408291e22def5755559f42cde913706a6d628c0Adam Powell * @return The current ActionBar subtitle or null. 33833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 33933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract CharSequence getSubtitle(); 34033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell 34133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 342a408291e22def5755559f42cde913706a6d628c0Adam Powell * Returns the current navigation mode. The result will be one of: 343a408291e22def5755559f42cde913706a6d628c0Adam Powell * <ul> 344a408291e22def5755559f42cde913706a6d628c0Adam Powell * <li>{@link #NAVIGATION_MODE_STANDARD}</li> 3459ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <li>{@link #NAVIGATION_MODE_LIST}</li> 346a408291e22def5755559f42cde913706a6d628c0Adam Powell * <li>{@link #NAVIGATION_MODE_TABS}</li> 347a408291e22def5755559f42cde913706a6d628c0Adam Powell * </ul> 348a408291e22def5755559f42cde913706a6d628c0Adam Powell * 34933b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @return The current navigation mode. 350a408291e22def5755559f42cde913706a6d628c0Adam Powell * 351661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #setStandardNavigationMode() 352a408291e22def5755559f42cde913706a6d628c0Adam Powell * @see #setStandardNavigationMode(CharSequence) 353a408291e22def5755559f42cde913706a6d628c0Adam Powell * @see #setStandardNavigationMode(CharSequence, CharSequence) 354a408291e22def5755559f42cde913706a6d628c0Adam Powell * @see #setDropdownNavigationMode(SpinnerAdapter) 355661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #setTabNavigationMode() 356a408291e22def5755559f42cde913706a6d628c0Adam Powell * @see #setCustomNavigationMode(View) 35733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 35833b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract int getNavigationMode(); 3599ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 3609ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 3619ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Set the current navigation mode. 3629ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3639ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param mode The new mode to set. 3649ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_STANDARD 3659ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_LIST 3669ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see #NAVIGATION_MODE_TABS 3679ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 3689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void setNavigationMode(int mode); 3699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 37033b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell /** 37133b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell * @return The current set of display options. 37233b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell */ 37333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell public abstract int getDisplayOptions(); 374661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 375661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 376661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Set the action bar into tabbed navigation mode. 377661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 378661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #addTab(Tab) 379661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #insertTab(Tab, int) 380661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #removeTab(Tab) 381661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #removeTabAt(int) 3829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 3839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @deprecated See {@link #setNavigationMode(int)} 384661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 385661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void setTabNavigationMode(); 386661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 387661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 388661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Create and return a new {@link Tab}. 389661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * This tab will not be included in the action bar until it is added. 390661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 391661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return A new Tab 392661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 393661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #addTab(Tab) 394661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #insertTab(Tab, int) 395661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 396661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract Tab newTab(); 397661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 398661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 399661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 40081b8944131946e451b31665652de8cc71d81ea07Adam Powell * If this is the first tab to be added it will become the selected tab. 401661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 402661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab Tab to add 403661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 404661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void addTab(Tab tab); 405661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 406661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 40781b8944131946e451b31665652de8cc71d81ea07Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. 40881b8944131946e451b31665652de8cc71d81ea07Adam Powell * 40981b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param tab Tab to add 41081b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param setSelected True if the added tab should become the selected tab. 41181b8944131946e451b31665652de8cc71d81ea07Adam Powell */ 41281b8944131946e451b31665652de8cc71d81ea07Adam Powell public abstract void addTab(Tab tab, boolean setSelected); 41381b8944131946e451b31665652de8cc71d81ea07Adam Powell 41481b8944131946e451b31665652de8cc71d81ea07Adam Powell /** 4152b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be inserted at 41681b8944131946e451b31665652de8cc71d81ea07Adam Powell * <code>position</code>. If this is the first tab to be added it will become 41781b8944131946e451b31665652de8cc71d81ea07Adam Powell * the selected tab. 418661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 419661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab The tab to add 420661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param position The new position of the tab 421661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 4222b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract void addTab(Tab tab, int position); 423661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 424661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 42581b8944131946e451b31665652de8cc71d81ea07Adam Powell * Add a tab for use in tabbed navigation mode. The tab will be insterted at 42681b8944131946e451b31665652de8cc71d81ea07Adam Powell * <code>position</code>. 42781b8944131946e451b31665652de8cc71d81ea07Adam Powell * 42881b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param tab The tab to add 42981b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param position The new position of the tab 43081b8944131946e451b31665652de8cc71d81ea07Adam Powell * @param setSelected True if the added tab should become the selected tab. 43181b8944131946e451b31665652de8cc71d81ea07Adam Powell */ 43281b8944131946e451b31665652de8cc71d81ea07Adam Powell public abstract void addTab(Tab tab, int position, boolean setSelected); 43381b8944131946e451b31665652de8cc71d81ea07Adam Powell 43481b8944131946e451b31665652de8cc71d81ea07Adam Powell /** 4359ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove a tab from the action bar. If the removed tab was selected it will be deselected 4369ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * and another tab will be selected if present. 437661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 438661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab The tab to remove 439661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 440661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void removeTab(Tab tab); 441661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 442661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 4439ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove a tab from the action bar. If the removed tab was selected it will be deselected 4449ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * and another tab will be selected if present. 445661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 446661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param position Position of the tab to remove 447661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 448661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void removeTabAt(int position); 449661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 450661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 4519ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Remove all tabs from the action bar and deselect the current tab. 4529ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 4539ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract void removeAllTabs(); 4549ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 4559ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 456661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Select the specified tab. If it is not a child of this action bar it will be added. 457661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 4589ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * <p>Note: If you want to select by index, use {@link #setSelectedNavigationItem(int)}.</p> 4599ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 460661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param tab Tab to select 461661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 462661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void selectTab(Tab tab); 463661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 464661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 4652b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Returns the currently selected tab if in tabbed navigation mode and there is at least 4662b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * one tab present. 4672b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 4682b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return The currently selected tab or null 4692b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 4702b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract Tab getSelectedTab(); 4712b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 4722b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 4739ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Returns the tab at the specified index. 4749ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 4759ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @param index Index value in the range 0-get 4769ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return 4779ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 4789ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab getTabAt(int index); 4799ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 4809ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 4810c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * Returns the number of tabs currently registered with the action bar. 4820c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * @return Tab count 4830c24a5514c1ff143a223720a090b19a86a75945fAdam Powell */ 4840c24a5514c1ff143a223720a090b19a86a75945fAdam Powell public abstract int getTabCount(); 4850c24a5514c1ff143a223720a090b19a86a75945fAdam Powell 4860c24a5514c1ff143a223720a090b19a86a75945fAdam Powell /** 4876b336f835d637853800b94689375a03f337139a4Adam Powell * Retrieve the current height of the ActionBar. 4886b336f835d637853800b94689375a03f337139a4Adam Powell * 4896b336f835d637853800b94689375a03f337139a4Adam Powell * @return The ActionBar's height 4906b336f835d637853800b94689375a03f337139a4Adam Powell */ 4916b336f835d637853800b94689375a03f337139a4Adam Powell public abstract int getHeight(); 4926b336f835d637853800b94689375a03f337139a4Adam Powell 4936b336f835d637853800b94689375a03f337139a4Adam Powell /** 4946b336f835d637853800b94689375a03f337139a4Adam Powell * Show the ActionBar if it is not currently showing. 4956b336f835d637853800b94689375a03f337139a4Adam Powell * If the window hosting the ActionBar does not have the feature 4966b336f835d637853800b94689375a03f337139a4Adam Powell * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 4976b336f835d637853800b94689375a03f337139a4Adam Powell * content to fit the new space available. 4986b336f835d637853800b94689375a03f337139a4Adam Powell */ 4996b336f835d637853800b94689375a03f337139a4Adam Powell public abstract void show(); 5006b336f835d637853800b94689375a03f337139a4Adam Powell 5016b336f835d637853800b94689375a03f337139a4Adam Powell /** 5026b336f835d637853800b94689375a03f337139a4Adam Powell * Hide the ActionBar if it is not currently showing. 5036b336f835d637853800b94689375a03f337139a4Adam Powell * If the window hosting the ActionBar does not have the feature 5046b336f835d637853800b94689375a03f337139a4Adam Powell * {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application 5056b336f835d637853800b94689375a03f337139a4Adam Powell * content to fit the new space available. 5066b336f835d637853800b94689375a03f337139a4Adam Powell */ 5076b336f835d637853800b94689375a03f337139a4Adam Powell public abstract void hide(); 5086b336f835d637853800b94689375a03f337139a4Adam Powell 5096b336f835d637853800b94689375a03f337139a4Adam Powell /** 5106b336f835d637853800b94689375a03f337139a4Adam Powell * @return <code>true</code> if the ActionBar is showing, <code>false</code> otherwise. 5116b336f835d637853800b94689375a03f337139a4Adam Powell */ 5126b336f835d637853800b94689375a03f337139a4Adam Powell public abstract boolean isShowing(); 5136b336f835d637853800b94689375a03f337139a4Adam Powell 5146b336f835d637853800b94689375a03f337139a4Adam Powell /** 51589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * Callback interface for ActionBar navigation events. 51689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell */ 51789e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell public interface NavigationCallback { 51889e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell /** 51989e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * This method is called whenever a navigation item in your action bar 52089e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * is selected. 52189e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * 52289e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @param itemPosition Position of the item clicked. 52389e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @param itemId ID of the item clicked. 52489e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell * @return True if the event was handled, false otherwise. 52589e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell */ 52689e0645b4157961e8c465eb9c819f965fdb453d8Adam Powell public boolean onNavigationItemSelected(int itemPosition, long itemId); 52733b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell } 528661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 529661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 530661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * A tab in the action bar. 531661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 532661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * <p>Tabs manage the hiding and showing of {@link Fragment}s. 533661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 534661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public static abstract class Tab { 535661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 536661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * An invalid position for a tab. 537661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 538661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @see #getPosition() 539661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 540661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public static final int INVALID_POSITION = -1; 541661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 542661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 543661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the current position of this tab in the action bar. 544661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 545661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return Current position, or {@link #INVALID_POSITION} if this tab is not currently in 546661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * the action bar. 547661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 548661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract int getPosition(); 549661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 550661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 551661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the icon associated with this tab. 552661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 553661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return The tab's icon 554661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 555661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract Drawable getIcon(); 556661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 557661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 558661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Return the text of this tab. 559661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 560661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @return The tab's text 561661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 562661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract CharSequence getText(); 563661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 564661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 565661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Set the icon displayed on this tab. 566661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 567661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param icon The drawable to use as an icon 5689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 569661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 5709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setIcon(Drawable icon); 571661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 572661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 573661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Set the text displayed on this tab. Text may be truncated if there is not 574661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * room to display the entire string. 575661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 576661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * @param text The text to display 5779ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 578661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 5799ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setText(CharSequence text); 580661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 581661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 5822b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Set a custom view to be used for this tab. This overrides values set by 5832b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * {@link #setText(CharSequence)} and {@link #setIcon(Drawable)}. 584661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 5852b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param view Custom view to be used as a tab. 5869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 587661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 5889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setCustomView(View view); 589661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 590661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 5912b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Retrieve a previously set custom view for this tab. 592661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * 5932b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return The custom view set by {@link #setCustomView(View)}. 594661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 5952b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract View getCustomView(); 5962b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 5972b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 5982b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Give this Tab an arbitrary object to hold for later use. 5992b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 6002b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param obj Object to store 6019ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 6022b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 6039ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setTag(Object obj); 6042b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 6052b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 6062b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @return This Tab's tag object. 6072b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 6082b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public abstract Object getTag(); 6092b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 6102b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 6112b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Set the {@link TabListener} that will handle switching to and from this tab. 6122b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * All tabs must have a TabListener set before being added to the ActionBar. 6132b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 6142b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param listener Listener to handle tab selection events 6159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @return The current instance for call chaining 6162b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 6179ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public abstract Tab setTabListener(TabListener listener); 618661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell 619661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell /** 620661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell * Select this tab. Only valid if the tab has been added to the action bar. 621661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell */ 622661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell public abstract void select(); 623661c908e4e26c99adc2cab7558a02129eaee059dAdam Powell } 6242b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 6252b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 6262b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Callback interface invoked when a tab is focused, unfocused, added, or removed. 6272b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 6282b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public interface TabListener { 6292b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 6302b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Called when a tab enters the selected state. 6312b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 6322b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param tab The tab that was selected 6332b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 6342b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * during a tab switch. The previous tab's unselect and this tab's select will be 6350c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * executed in a single transaction. This FragmentTransaction does not support 6360c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * being added to the back stack. 6372b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 6382b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public void onTabSelected(Tab tab, FragmentTransaction ft); 6392b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell 6402b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell /** 6412b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * Called when a tab exits the selected state. 6422b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * 6432b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param tab The tab that was unselected 6442b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 6452b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell * during a tab switch. This tab's unselect and the newly selected tab's select 6460c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * will be executed in a single transaction. This FragmentTransaction does not 6470c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * support being added to the back stack. 6482b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell */ 6492b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell public void onTabUnselected(Tab tab, FragmentTransaction ft); 6507f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell 6517f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell /** 6527f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * Called when a tab that is already selected is chosen again by the user. 6537f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * Some applications may use this action to return to the top level of a category. 6547f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * 6557f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * @param tab The tab that was reselected. 6567f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell * @param ft A {@link FragmentTransaction} for queuing fragment operations to execute 6570c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * once this method returns. This FragmentTransaction does not support 6580c24a5514c1ff143a223720a090b19a86a75945fAdam Powell * being added to the back stack. 6597f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell */ 6607f9b90542e05b350d14bd63c16446c8ce2baf407Adam Powell public void onTabReselected(Tab tab, FragmentTransaction ft); 6612b6230e0de4bac2829ac27b19e95ba75c3da82b4Adam Powell } 6629ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 6639ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 6649ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Per-child layout information associated with action bar custom views. 6659ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 6669ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @attr ref android.R.styleable#ActionBar_LayoutParams_layout_gravity 6679ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 6689ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public static class LayoutParams extends MarginLayoutParams { 6699ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell /** 6709ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * Gravity for the view associated with these LayoutParams. 6719ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * 6729ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell * @see android.view.Gravity 6739ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell */ 6749ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.ExportedProperty(category = "layout", mapping = { 6759ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = -1, to = "NONE"), 6769ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.NO_GRAVITY, to = "NONE"), 6779ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.TOP, to = "TOP"), 6789ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.BOTTOM, to = "BOTTOM"), 6799ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.LEFT, to = "LEFT"), 6809ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.RIGHT, to = "RIGHT"), 6819ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER_VERTICAL, to = "CENTER_VERTICAL"), 6829ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.FILL_VERTICAL, to = "FILL_VERTICAL"), 6839ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER_HORIZONTAL, to = "CENTER_HORIZONTAL"), 6849ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.FILL_HORIZONTAL, to = "FILL_HORIZONTAL"), 6859ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.CENTER, to = "CENTER"), 6869ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell @ViewDebug.IntToString(from = Gravity.FILL, to = "FILL") 6879ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell }) 6889ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public int gravity = -1; 6899ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 6909ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(Context c, AttributeSet attrs) { 6919ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(c, attrs); 6929ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 6939ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell TypedArray a = c.obtainStyledAttributes(attrs, 6949ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell com.android.internal.R.styleable.ActionBar_LayoutParams); 6959ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell gravity = a.getInt( 6969ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell com.android.internal.R.styleable.ActionBar_LayoutParams_layout_gravity, -1); 6979ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 6989ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 6999ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int width, int height) { 7009ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(width, height); 7019ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell this.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT; 7029ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 7039ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 7049ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int width, int height, int gravity) { 7059ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(width, height); 7069ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell this.gravity = gravity; 7079ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 7089ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 7099ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(int gravity) { 7109ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell this(WRAP_CONTENT, MATCH_PARENT, gravity); 7119ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 7129ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 7139ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(LayoutParams source) { 7149ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(source); 7159ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 7169ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell this.gravity = source.gravity; 7179ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 7189ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell 7199ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell public LayoutParams(ViewGroup.LayoutParams source) { 7209ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell super(source); 7219ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 7229ab978713ce86fdaefed2407f4f3c998ab0e3178Adam Powell } 72333b974393b6fadcefc896ec4a0f9b66724f61e9fAdam Powell} 724