本文整理汇总了Java中com.actionbarsherlock.view.MenuItem.SHOW_AS_ACTION_IF_ROOM属性的典型用法代码示例。如果您正苦于以下问题:Java MenuItem.SHOW_AS_ACTION_IF_ROOM属性的具体用法?Java MenuItem.SHOW_AS_ACTION_IF_ROOM怎么用?Java MenuItem.SHOW_AS_ACTION_IF_ROOM使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.actionbarsherlock.view.MenuItem
的用法示例。
在下文中一共展示了MenuItem.SHOW_AS_ACTION_IF_ROOM属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateOptionsMenu
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
int action = getResources().getBoolean(R.bool.menu_in_bar) ? MenuItem.SHOW_AS_ACTION_IF_ROOM : MenuItem.SHOW_AS_ACTION_NEVER;
MenuItem delMenu = menu.add(isDigit ? R.string.switch_to_text : R.string.switch_to_digit);
delMenu.setIcon(
isDigit ? R.drawable.ic_menu_switch_txt
: R.drawable.ic_menu_switch_digit).setShowAsAction( action );
delMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
setTextDialing(isDigit);
return true;
}
});
}
示例2: onCreateOptionsMenu
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
int actionRoom = getResources().getBoolean(R.bool.menu_in_bar) ? MenuItem.SHOW_AS_ACTION_IF_ROOM : MenuItem.SHOW_AS_ACTION_NEVER;
MenuItem addContactMenu = menu.add(R.string.menu_add_to_contacts);
addContactMenu.setIcon(R.drawable.ic_add_contact_holo_dark).setShowAsAction(actionRoom);
addContactMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
Intent it = ContactsWrapper.getInstance().getAddContactIntent(null, remoteFrom);
startActivity(it);
return true;
}
});
}
示例3: onCreateOptionsMenu
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
int actionRoom = getResources().getBoolean(R.bool.menu_in_bar) ? MenuItem.SHOW_AS_ACTION_IF_ROOM : MenuItem.SHOW_AS_ACTION_NEVER;
MenuItem delMenu = menu.add(R.string.callLog_delete_all);
delMenu.setIcon(R.drawable.ic_ab_trash_dark).setShowAsAction(actionRoom);
delMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
deleteAllCalls();
return true;
}
});
}
示例4: onCreateOptionsMenu
@Override
public boolean onCreateOptionsMenu(Menu menu) {
int actionRoom = getResources().getBoolean(R.bool.menu_in_bar) ? MenuItem.SHOW_AS_ACTION_IF_ROOM : MenuItem.SHOW_AS_ACTION_NEVER;
WizardInfo distribWizard = CustomDistribution.getCustomDistributionWizard();
if (distribWizard != null) {
menu.add(Menu.NONE, DISTRIB_ACCOUNT_MENU, Menu.NONE, "My " + distribWizard.label)
.setIcon(distribWizard.icon)
.setShowAsAction(actionRoom);
}
if (CustomDistribution.distributionWantsOtherAccounts()) {
int accountRoom = actionRoom;
if(Compatibility.isCompatible(13)) {
accountRoom |= MenuItem.SHOW_AS_ACTION_WITH_TEXT;
}
menu.add(Menu.NONE, ACCOUNTS_MENU, Menu.NONE,
(distribWizard == null) ? R.string.accounts : R.string.other_accounts)
.setIcon(R.drawable.ic_menu_account_list)
.setAlphabeticShortcut('a')
.setShowAsAction( accountRoom );
}
menu.add(Menu.NONE, PARAMS_MENU, Menu.NONE, R.string.prefs)
.setIcon(android.R.drawable.ic_menu_preferences)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
menu.add(Menu.NONE, HELP_MENU, Menu.NONE, R.string.help)
.setIcon(android.R.drawable.ic_menu_help)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
menu.add(Menu.NONE, CLOSE_MENU, Menu.NONE, R.string.menu_disconnect)
.setIcon(R.drawable.ic_lock_power_off)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
return super.onCreateOptionsMenu(menu);
}