本文整理汇总了Java中com.actionbarsherlock.view.Menu类的典型用法代码示例。如果您正苦于以下问题:Java Menu类的具体用法?Java Menu怎么用?Java Menu使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Menu类属于com.actionbarsherlock.view包,在下文中一共展示了Menu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateOptionsMenu
import com.actionbarsherlock.view.Menu; //导入依赖的package包/类
@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
import com.actionbarsherlock.view.Menu; //导入依赖的package包/类
@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
import com.actionbarsherlock.view.Menu; //导入依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.add(R.string.add_filter)
.setIcon(android.R.drawable.ic_menu_add)
.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
onClickAddFilter();
return true;
}
})
.setShowAsAction(
MenuItem.SHOW_AS_ACTION_IF_ROOM );
super.onCreateOptionsMenu(menu, inflater);
}
示例4: onCreateOptionsMenu
import com.actionbarsherlock.view.Menu; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (mIsShowSaveButton){
MenuItem miSave = menu.add("保存");
miSave.setIcon(R.drawable.head_save);
miSave.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
miSave.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
savePInfo(true);
return false;
}
});
}
return super.onCreateOptionsMenu(menu);
}
示例5: onPrepareOptionsMenu
import com.actionbarsherlock.view.Menu; //导入依赖的package包/类
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
menu.findItem(R.id.system).setChecked(showSystemApps);
switch (currentSort) {
case NAME:
menu.findItem(R.id.name).setChecked(true);
break;
case DATE:
menu.findItem(R.id.date).setChecked(true);
break;
case SIZE:
menu.findItem(R.id.size).setChecked(true);
break;
case STATE:
menu.findItem(R.id.status).setChecked(true);
break;
}
return super.onPrepareOptionsMenu(menu);
}
示例6: onCreateOptionsMenu
import com.actionbarsherlock.view.Menu; //导入依赖的package包/类
@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;
}
});
}
示例7: onPrepareActionMode
import com.actionbarsherlock.view.Menu; //导入依赖的package包/类
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
Log.d(THIS_FILE, "onPrepareActionMode");
ListView lv = getListView();
int nbrCheckedItem = 0;
for (int i = 0; i < lv.getCount(); i++) {
if (lv.isItemChecked(i)) {
nbrCheckedItem++;
}
}
menu.findItem(R.id.delete).setVisible(nbrCheckedItem > 0);
menu.findItem(R.id.dialpad).setVisible(nbrCheckedItem == 1);
return false;
}
示例8: onCreateOptionsMenu
import com.actionbarsherlock.view.Menu; //导入依赖的package包/类
@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);
}
示例9: onCreateOptionsMenu
import com.actionbarsherlock.view.Menu; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(Menu.NONE, SAVE_MENU, Menu.NONE, R.string.save).setIcon(android.R.drawable.ic_menu_save);
if (account.id != SipProfile.INVALID_ID) {
menu.add(Menu.NONE, TRANSFORM_MENU, Menu.NONE, R.string.choose_wizard).setIcon(android.R.drawable.ic_menu_edit);
menu.add(Menu.NONE, FILTERS_MENU, Menu.NONE, R.string.filters).setIcon(R.drawable.ic_menu_filter);
menu.add(Menu.NONE, DELETE_MENU, Menu.NONE, R.string.delete_account).setIcon(android.R.drawable.ic_menu_delete);
}
return super.onCreateOptionsMenu(menu);
}
示例10: onMenuOpened
import com.actionbarsherlock.view.Menu; //导入依赖的package包/类
@Override
public final boolean onMenuOpened(int featureId, android.view.Menu menu) {
if (getSherlock().dispatchMenuOpened(featureId, menu)) {
return true;
}
return super.onMenuOpened(featureId, menu);
}
示例11: onCreatePanelMenu
import com.actionbarsherlock.view.Menu; //导入依赖的package包/类
@Override
public boolean onCreatePanelMenu(int featureId, Menu menu) {
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
return onCreateOptionsMenu(menu);
}
return false;
}
示例12: onPreparePanel
import com.actionbarsherlock.view.Menu; //导入依赖的package包/类
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
return onPrepareOptionsMenu(menu);
}
return false;
}
示例13: onCreatePanelMenu
import com.actionbarsherlock.view.Menu; //导入依赖的package包/类
@Override
public final boolean onCreatePanelMenu(int featureId, android.view.Menu menu) {
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onCreatePanelMenu] featureId: " + featureId + ", menu: " + menu);
if (featureId == Window.FEATURE_OPTIONS_PANEL && !mIgnoreNativeCreate) {
mIgnoreNativeCreate = true;
boolean result = getSherlock().dispatchCreateOptionsMenu(menu);
mIgnoreNativeCreate = false;
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onCreatePanelMenu] returning " + result);
return result;
}
return super.onCreatePanelMenu(featureId, menu);
}
示例14: onPreparePanel
import com.actionbarsherlock.view.Menu; //导入依赖的package包/类
@Override
public final boolean onPreparePanel(int featureId, View view, android.view.Menu menu) {
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] featureId: " + featureId + ", view: " + view + ", menu: " + menu);
if (featureId == Window.FEATURE_OPTIONS_PANEL && !mIgnoreNativePrepare) {
mIgnoreNativePrepare = true;
boolean result = getSherlock().dispatchPrepareOptionsMenu(menu);
mIgnoreNativePrepare = false;
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] returning " + result);
return result;
}
return super.onPreparePanel(featureId, view, menu);
}
示例15: dispatchCreateOptionsMenu
import com.actionbarsherlock.view.Menu; //导入依赖的package包/类
@Override
public boolean dispatchCreateOptionsMenu(android.view.Menu menu) {
if (BuildConfig.DEBUG) {
Log.d(TAG, "[dispatchCreateOptionsMenu] android.view.Menu: " + menu);
Log.d(TAG, "[dispatchCreateOptionsMenu] returning true");
}
return true;
}