@Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   MenuItem item = menu.add(Menu.NONE, MENU_DISCARD, MENU_DISCARD, R.string.rate_offline_discard);
   item.setIcon(R.drawable.ic_action_discard);
   item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
   super.onCreateOptionsMenu(menu, inflater);
 }
Пример #2
0
 protected void addMenuItem(Menu menu, int title, int imageRes, int id, boolean showAsAction) {
   AstridActivity activity = (AstridActivity) getActivity();
   if ((activity.getFragmentLayout() != AstridActivity.LAYOUT_SINGLE && showAsAction)
       || !(activity instanceof TaskListActivity)) {
     MenuItem item = menu.add(Menu.NONE, id, Menu.NONE, title);
     item.setIcon(imageRes);
     if (activity instanceof TaskListActivity)
       item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
   } else {
     ((TaskListActivity) activity).getMainMenuPopover().addMenuItem(title, imageRes, id);
   }
 }