本文整理汇总了Java中com.actionbarsherlock.view.MenuItem.setOnMenuItemClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java MenuItem.setOnMenuItemClickListener方法的具体用法?Java MenuItem.setOnMenuItemClickListener怎么用?Java MenuItem.setOnMenuItemClickListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.actionbarsherlock.view.MenuItem
的用法示例。
在下文中一共展示了MenuItem.setOnMenuItemClickListener方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateOptionsMenu
import com.actionbarsherlock.view.MenuItem; //导入方法依赖的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.MenuItem; //导入方法依赖的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.MenuItem; //导入方法依赖的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.MenuItem; //导入方法依赖的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;
}
});
}
示例5: onCreateOptionsMenu
import com.actionbarsherlock.view.MenuItem; //导入方法依赖的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);
}
示例6: run
import com.actionbarsherlock.view.MenuItem; //导入方法依赖的package包/类
@Override
public void run() {
MenuItem item = mMenuBuilder.add(R.id.menu_accbtn_accounts, Menu.NONE, Menu.NONE, ch.getLabel().toString());
item.setIcon(ch.getIconDrawable());
item.setOnMenuItemClickListener(new OnAccountMenuItemListener(ch.getFakeProfile()));
}