menu的显示方式
boolean android.app.Activity.onCreateOptionsMenu(Menu menu)
MenuItem actionItem = menu.add("Action Button");
actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
setShowAsAction:设置ActionBar中menu的显示方式
/** 从不显示。Never show this item as a button in an Action Bar. */
public static final int SHOW_AS_ACTION_NEVER = 0;
/**
*<span style="line-height: 25.2px; font-family: Helvetica, Tahoma, Arial, sans-serif;">有空间就显示。</span>
*Show this item as a button in an Action Bar if the system decides there is room for it. */
public static final int SHOW_AS_ACTION_IF_ROOM = 1;
/**
* 总是显示
*Always show this item as a button in an Action Bar.
* Use sparingly! If too many items are set to always show in the Action Bar it can
* crowd the Action Bar and degrade the user experience on devices with smaller screens.
* A good rule of thumb is to have no more than 2 items set to always show at a time.
*/
public static final int SHOW_AS_ACTION_ALWAYS = 2;
/**
<span style="font-family:Helvetica, Tahoma, Arial, sans-serif;">*</span><span style="font-family:Helvetica, Tahoma, Arial, sans-serif;">显示时跟谁文字</span><span style="font-family:Helvetica, Tahoma, Arial, sans-serif;">
* When this item is in the action bar, always show it with a text label even if
* it also has an icon specified.
*/
public static final int SHOW_AS_ACTION_WITH_TEXT = 4;
/**</span>
*默认收缩其 action view
* This item's action view collapses to a normal menu item.
* When expanded, the action view temporarily takes over
* a larger segment of its container.
*/
public static final int SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW = 8;