/** * Set an action view for this menu item. An action view will be displayed in place of an * automatically generated menu item element in the UI when this item is shown as an action within * a parent. * * @param resId Layout resource to use for presenting this item to the user. * @return This Item so additional setters can be called. * @see #setActionView(View) */ public MenuItem setActionView(int resId) { if (mMenuItem != null) { HoneycombMenuItem.setActionView(mMenuItem, resId); } return this; }
/** * Sets how this item should display in the presence of an Action Bar. The parameter actionEnum is * a flag set. One of {@link #SHOW_AS_ACTION_ALWAYS}, {@link #SHOW_AS_ACTION_IF_ROOM}, or {@link * #SHOW_AS_ACTION_NEVER} should be used, and you may optionally OR the value with {@link * #SHOW_AS_ACTION_WITH_TEXT}. {@link #SHOW_AS_ACTION_WITH_TEXT} requests that when the item is * shown as an action, it should be shown with a text label. * * @param actionEnum How the item should display. One of {@link #SHOW_AS_ACTION_ALWAYS}, {@link * #SHOW_AS_ACTION_IF_ROOM}, or {@link #SHOW_AS_ACTION_NEVER}. {@link #SHOW_AS_ACTION_NEVER} * is the default. */ public void setShowAsAction(int actionEnum) { if (mMenuItem != null) { HoneycombMenuItem.setShowAsAction(mMenuItem, actionEnum); } }
/** * Returns the currently set action view for this menu item. * * @return The item's action view * @see #setActionView(int) * @see #setActionView(View) * @see #setShowAsAction(int) */ public View getActionView() { if (mMenuItem != null) { return HoneycombMenuItem.getActionView(mMenuItem); } return null; }
/** * Set an action view for this menu item. An action view will be displayed in place of an * automatically generated menu item element in the UI when this item is shown as an action within * a parent. * * @param view View to use for presenting this item to the user. * @return This Item so additional setters can be called. * @see #setActionView(int) */ public MenuItem setActionView(View view) { if (mMenuItem != null) { HoneycombMenuItem.setActionView(mMenuItem, view); } return this; }