本文整理汇总了Java中com.actionbarsherlock.view.Menu.add方法的典型用法代码示例。如果您正苦于以下问题:Java Menu.add方法的具体用法?Java Menu.add怎么用?Java Menu.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.actionbarsherlock.view.Menu
的用法示例。
在下文中一共展示了Menu.add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 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);
}
示例4: onCreateOptionsMenu
import com.actionbarsherlock.view.Menu; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
menu.add(0,CONSOLE_CODE,0,getString(R.string.menu_console))
.setIcon(R.drawable.hardware_dock)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
menu_install_php=menu.add(0,INSTALL_PHP_CODE,0,getString(R.string.menu_install_php));
menu_download_server=menu.add(0,DOWNLOAD_SERVER_CODE,0,getString(R.string.menu_download));
menu_delete_server=menu.add(0,DELETE_SERVER,0,getString(R.string.menu_delete_server));
menu_backup_server=menu.add(0,BACKUP_SERVER,0,getString(R.string.menu_backup_server));
menu_force_close= menu.add(0,FORCE_CLOSE_CODE,0,getString(R.string.menu_kill));
menu_hp=menu.add(0,HP,0,getString(R.string.menu_hp));
menu_twitter=menu.add(0,TWITTER,0,getString(R.string.menu_twitter));
menu_bl_twitter=menu.add(0,BL_TWITTER,0,getString(R.string.menu_bl_twitter));
menu_help=menu.add(0,HELP,0,getString(R.string.menu_help));
return true;
}
示例5: 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;
}
});
}
示例6: onCreateOptionsMenu
import com.actionbarsherlock.view.Menu; //导入方法依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// MenuItem miAdd = menu.add("添加乘车人");
// miAdd.setIcon(R.drawable.head_add);
// miAdd.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
// miAdd.setOnMenuItemClickListener(new OnMenuItemClickListener() {
//
// @Override
// public boolean onMenuItemClick(MenuItem item) {
// Intent intent = new Intent(PassengerMangAty.this,
// EditPassengerAty.class);
// intent.putExtra(EditPassengerAty.EXTRA_OPERATE, EditPassengerAty.EXTRA_OPERATE_ADD);
// startActivityForResult(intent, REQUEST_ADD);
// return false;
// }
// });
MenuItem miSync = menu.add("同步12306乘车人");
miSync.setIcon(R.drawable.refesh);
miSync.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
miSync.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
//初始化变量
mNoPInfoAtLocalType = 0;
mPInfoConflictType = 0;
syncPassengers();
return false;
}
});
return super.onCreateOptionsMenu(menu);
}
示例7: onCreateOptionsMenu
import com.actionbarsherlock.view.Menu; //导入方法依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
MenuItem populateItem = menu.add(Menu.NONE, 1, 0, "Populate");
populateItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
MenuItem clearItem = menu.add(Menu.NONE, 2, 0, "Clear");
clearItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
super.onCreateOptionsMenu(menu, inflater);
}