Methods Summary |
---|
public static com.android.layoutlib.bridge.bars.FrameworkActionBarWrapper | getActionBarWrapper(com.android.layoutlib.bridge.android.BridgeContext context, com.android.ide.common.rendering.api.ActionBarCallback callback, android.view.View decorContent)Returns a wrapper around different implementations of the Action Bar to provide a common API.
View view = decorContent.findViewById(R.id.action_bar);
if (view instanceof Toolbar) {
return new ToolbarWrapper(context, callback, (Toolbar) view);
} else if (view instanceof ActionBarView) {
return new WindowActionBarWrapper(context, callback, decorContent,
(ActionBarView) view);
} else {
throw new IllegalStateException("Can't make an action bar out of " +
view.getClass().getSimpleName());
}
|
protected android.content.Context | getActionMenuContext()The context used for the ActionBar and the menus in the ActionBarView.
return mActionBar.getThemedContext();
|
abstract android.widget.ActionMenuPresenter | getActionMenuPresenter()
|
abstract com.android.internal.widget.DecorToolbar | getDecorToolbar()Framework's wrapper over two ActionBar implementations.
|
abstract com.android.internal.view.menu.MenuBuilder | getMenuBuilder()The Menu in which to inflate the user's menus.
|
abstract int | getMenuPopupElevation()
|
abstract int | getMenuPopupMargin()Margin between the menu popup and the action bar.
|
abstract android.content.Context | getPopupContext()The context used to inflate the popup menu.
|
protected void | inflateMenus()Gets the menus to add to the action bar from the callback, resolves them, inflates them and
adds them to the action bar.
MenuInflater inflater = new MenuInflater(getActionMenuContext());
MenuBuilder menuBuilder = getMenuBuilder();
for (String name : mCallback.getMenuIdNames()) {
int id;
if (name.startsWith(ANDROID_NS_NAME_PREFIX)) {
// Framework menu.
name = name.substring(ANDROID_NS_NAME_PREFIX.length());
id = mContext.getFrameworkResourceValue(MENU, name, -1);
} else {
// Project menu.
id = mContext.getProjectResourceValue(MENU, name, -1);
}
if (id > -1) {
inflater.inflate(id, menuBuilder);
}
}
|
protected boolean | isOverflowPopupNeeded()
return mCallback.isOverflowPopupNeeded();
|
protected boolean | isSplit()
return getDecorToolbar().isSplit();
|
public void | setHomeAsUp(boolean homeAsUp)
mActionBar.setDisplayHomeAsUpEnabled(homeAsUp);
|
public void | setIcon(java.lang.String icon)
// Nothing to do.
|
public void | setSubTitle(java.lang.CharSequence subTitle)
if (subTitle != null) {
mActionBar.setSubtitle(subTitle);
}
|
public void | setTitle(java.lang.CharSequence title)
mActionBar.setTitle(title);
|
protected void | setupActionBar()A call to setup any custom properties.
// Nothing to do here.
|