Java Code Examples for com.actionbarsherlock.view.MenuItem#setShowAsAction()
The following examples show how to use
com.actionbarsherlock.view.MenuItem#setShowAsAction() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EditPassengerAty.java From Huochexing12306 with Apache License 2.0 | 6 votes |
@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); }
Example 2
Source File: ProfileEdit.java From Favorite-Android-Client with Apache License 2.0 | 6 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuItem item; SubMenu subMenu1 = menu.addSubMenu(getString(R.string.permission)); subMenu1.add(0, 1001, 0, getString(R.string.privacy_content)); subMenu1.add(0, 1002, 0, getString(R.string.write_permission)); MenuItem subMenu1Item = subMenu1.getItem(); subMenu1Item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); if(!Global.getSetting("user_srl", "0").matches(member_srl)) menu.add(0, 1, 0, getString(R.string.delete)) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); // item = menu.add(0, 1, 0, R.string.Main_MenuAddBookmark); // item.setIcon(R.drawable.ic_menu_add_bookmark); return true; }
Example 3
Source File: document_write.java From Favorite-Android-Client with Apache License 2.0 | 6 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem item; SubMenu subMenu1 = menu.addSubMenu(getString(R.string.attach)); subMenu1.add(0, 1001, 0, getString(R.string.camera)); subMenu1.add(0, 1002, 0, getString(R.string.choose_picture)); subMenu1.add(0, 1003, 0, getString(R.string.attach_file)); // subMenu1.add(0, 1004, 0, "목록"); if(attach_exist) subMenu1.add(0, 1005, 0, getString(R.string.delete)); MenuItem subMenu1Item = subMenu1.getItem(); menu.add(0, 2, 0, getString(R.string.privacy_content)).setShowAsAction( MenuItem.SHOW_AS_ACTION_NEVER); subMenu1Item.setIcon(R.drawable.ic_file_light); subMenu1Item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.add(0, 1, 0, getString(R.string.write)).setIcon(R.drawable.accept) .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return true; }
Example 4
Source File: PassengerMangAty.java From Huochexing12306 with Apache License 2.0 | 5 votes |
@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); }