當前位置: 首頁>>代碼示例>>Java>>正文


Java Menu.clear方法代碼示例

本文整理匯總了Java中android.view.Menu.clear方法的典型用法代碼示例。如果您正苦於以下問題:Java Menu.clear方法的具體用法?Java Menu.clear怎麽用?Java Menu.clear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.Menu的用法示例。


在下文中一共展示了Menu.clear方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onPrepareOptionsMenu

import android.view.Menu; //導入方法依賴的package包/類
@Override
  public boolean onPrepareOptionsMenu(Menu menu) {
      menu.clear(); //Clear view of previous menu
      if (mnMode == START_FILE_EDITOR_BY_ITSELF)	{
      	menu.add(0, ITEM0, 0, getString(R.string.file_editor_menu_new));
      }
      if (mnMode == START_FILE_EDITOR_BY_ITSELF)	{
  		menu.add(0, ITEM1, 0, getString(R.string.file_editor_menu_open));
      }
      if (mbIsFileDirty && mstrFilePath.equals("") == false)	{
      	menu.add(0, ITEM2, 0, getString(R.string.file_editor_menu_save));
  	}
      if (mnMode == START_FILE_EDITOR_BY_ITSELF)	{
  		menu.add(0, ITEM3, 0, getString(R.string.file_editor_menu_save_as));
      }
  	menu.add(0, ITEM4, 0, getString(R.string.file_editor_menu_goto_line));
if (mnSoftKeyState == ENABLE_SHOW_SOFTKEY)	{
	menu.add(0, ITEM5, 0, getString(R.string.hide_system_soft_key));			
} else	{
	menu.add(0, ITEM5, 0, getString(R.string.pop_up_system_soft_key));			
}
menu.add(0, ITEM6, 0, getString(R.string.menu_help));

      return super.onPrepareOptionsMenu(menu);
  }
 
開發者ID:woshiwpa,項目名稱:SmartMath,代碼行數:26,代碼來源:ScriptEditorActivity.java

示例2: onPrepareOptionsMenu

import android.view.Menu; //導入方法依賴的package包/類
@Override
public boolean onPrepareOptionsMenu(Menu menu)
{
    Log.v(L.TAG, "SimplyDoActivity.onPrepareOptionsMenu() called");
    
    menu.clear();
    ViewSwitcher viewSwitch = (ViewSwitcher)findViewById(R.id.ListsItemsSwitcher);
    boolean isItemDisplay = viewSwitch.getDisplayedChild() != 0;
    
    if(isItemDisplay)
    {
        MenuItem deleteInactiveMI = menu.add(Menu.NONE, DELETE_INACTIVE, Menu.NONE, "Delete Inactive");
        deleteInactiveMI.setIcon(android.R.drawable.ic_menu_delete);
    }
    
    MenuItem settingsMI = menu.add(Menu.NONE, SETTINGS, Menu.NONE, "Settings");
    settingsMI.setIcon(android.R.drawable.ic_menu_preferences);
    
    if(isItemDisplay)
    {
        MenuItem sortNowMI = menu.add(Menu.NONE, SORT_NOW, Menu.NONE, "Sort Now");
        sortNowMI.setIcon(android.R.drawable.ic_menu_sort_by_size);
    }
    
    return true;
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:27,代碼來源:SimplyDoActivity.java

示例3: setActions

import android.view.Menu; //導入方法依賴的package包/類
void setActions(@Nullable ReadableArray actions) {
  Menu menu = getMenu();
  menu.clear();
  mActionsHolder.clear();
  if (actions != null) {
    for (int i = 0; i < actions.size(); i++) {
      ReadableMap action = actions.getMap(i);

      MenuItem item = menu.add(Menu.NONE, Menu.NONE, i, action.getString(PROP_ACTION_TITLE));

      if (action.hasKey(PROP_ACTION_ICON)) {
        setMenuItemIcon(item, action.getMap(PROP_ACTION_ICON));
      }

      int showAsAction = action.hasKey(PROP_ACTION_SHOW)
          ? action.getInt(PROP_ACTION_SHOW)
          : MenuItem.SHOW_AS_ACTION_NEVER;
      if (action.hasKey(PROP_ACTION_SHOW_WITH_TEXT) &&
          action.getBoolean(PROP_ACTION_SHOW_WITH_TEXT)) {
        showAsAction = showAsAction | MenuItem.SHOW_AS_ACTION_WITH_TEXT;
      }
      item.setShowAsAction(showAsAction);
    }
  }
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:26,代碼來源:ReactToolbar.java

示例4: onPrepareOptionsMenu

import android.view.Menu; //導入方法依賴的package包/類
@Override
public void onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);
    menu.clear();
    getActivity().getMenuInflater().inflate(R.menu.menu_song, menu);

    if (PreferencesHelper.getInstance().getString(PreferencesHelper.Key.SONG_SORT_TYPE, Constants.ASCENDING).equalsIgnoreCase(Constants.ASCENDING)) {
        menu.findItem(R.id.sort_song_type).setChecked(true);
    } else {
        menu.findItem(R.id.sort_song_type).setChecked(false);
    }

    String songSortOrder = PreferencesHelper.getInstance().getString(PreferencesHelper.Key.SONG_SORT_ORDER, SortOrder.SongSortOrder.SONG_DEFAULT);

    if (songSortOrder.equalsIgnoreCase(SortOrder.SongSortOrder.SONG_DEFAULT)) {
        menu.findItem(R.id.sort_song_default).setChecked(true);
    } else if (songSortOrder.equalsIgnoreCase(SortOrder.SongSortOrder.SONG_DISPLAY_NAME)) {
        menu.findItem(R.id.sort_song_name).setChecked(true);
    } else if (songSortOrder.equalsIgnoreCase(SortOrder.SongSortOrder.SONG_TRACK_NO)) {
        menu.findItem(R.id.sort_song_track_no).setChecked(true);
    } else if (songSortOrder.equalsIgnoreCase(SortOrder.SongSortOrder.SONG_DURATION)) {
        menu.findItem(R.id.sort_song_duration).setChecked(true);
    } else if (songSortOrder.equalsIgnoreCase(SortOrder.SongSortOrder.SONG_YEAR)) {
        menu.findItem(R.id.sort_song_year).setChecked(true);
    } else if (songSortOrder.equalsIgnoreCase(SortOrder.SongSortOrder.SONG_DATE)) {
        menu.findItem(R.id.sort_song_date_added).setChecked(true);
    } else if (songSortOrder.equalsIgnoreCase(SortOrder.SongSortOrder.SONG_ALBUM)) {
        menu.findItem(R.id.sort__song_album_name).setChecked(true);
    } else if (songSortOrder.equalsIgnoreCase(SortOrder.SongSortOrder.SONG_ARTIST)) {
        menu.findItem(R.id.sort_song_artist_name).setChecked(true);
    } else if (songSortOrder.equalsIgnoreCase(SortOrder.SongSortOrder.SONG_FILENAME)) {
        menu.findItem(R.id.sort_song_file_name).setChecked(true);
    }

}
 
開發者ID:reyanshmishra,項目名稱:Rey-MusicPlayer,代碼行數:36,代碼來源:SongsFragment.java

示例5: onCreateOptionsMenu

import android.view.Menu; //導入方法依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    menu.clear(); //hide the option menu
    return true;
}
 
開發者ID:peterdestasio,項目名稱:Geoclick,代碼行數:8,代碼來源:MainActivity.java

示例6: onCreateActionMode

import android.view.Menu; //導入方法依賴的package包/類
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
	TerminalTextViewOverlay.this.selectionActionMode = mode;

	menu.clear();

	menu.add(0, COPY, 0, R.string.console_menu_copy)
			.setIcon(R.drawable.ic_action_copy)
			.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT | MenuItem.SHOW_AS_ACTION_IF_ROOM);
	menu.add(0, PASTE, 1, R.string.console_menu_paste)
			.setIcon(R.drawable.ic_action_paste)
			.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT | MenuItem.SHOW_AS_ACTION_IF_ROOM);

	return true;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:16,代碼來源:TerminalTextViewOverlay.java

示例7: onPrepareOptionsMenu

import android.view.Menu; //導入方法依賴的package包/類
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  super.onPrepareOptionsMenu(menu);

  menu.clear();
  if (gridView.getAdapter() != null && gridView.getAdapter().getItemCount() > 0) {
    MenuInflater inflater = this.getMenuInflater();
    inflater.inflate(R.menu.media_overview, menu);
  }

  return true;
}
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:13,代碼來源:MediaOverviewActivity.java

示例8: onPrepareOptionsPanel

import android.view.Menu; //導入方法依賴的package包/類
@Override
protected boolean onPrepareOptionsPanel(View view, Menu menu) {
  MenuInflater inflater = this.getMenuInflater();
  menu.clear();
  inflater.inflate(R.menu.new_conversation_activity, menu);
  super.onPrepareOptionsMenu(menu);
  return true;
}
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:9,代碼來源:NewConversationActivity.java

示例9: onCreateOptionsMenu

import android.view.Menu; //導入方法依賴的package包/類
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    if (menu != null && menu.size() > 0) {
        menu.clear();
    }
    if (this.address_type == 1) {
        menu.add(0, 1, 1, R.string.b0).setShowAsAction(2);
    } else if (this.address_type == 2) {
        menu.add(0, 1, 1, R.string.aat).setShowAsAction(2);
    }
    return true;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:13,代碼來源:AddressEditActivity.java

示例10: onCreateOptionsMenu

import android.view.Menu; //導入方法依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.clear();
    menu.add(Menu.NONE, R.string.version, Menu.NONE, R.string.version);
    if (BuildConfig.RELEASE) {
        menu.add(Menu.NONE, R.string.feedback, Menu.NONE, R.string.feedback);
    }
    menu.add(Menu.NONE, R.string.advanced_settings, Menu.NONE, R.string.advanced_settings);
    return super.onCreateOptionsMenu(menu);
}
 
開發者ID:brevent,項目名稱:prevent,代碼行數:11,代碼來源:UserGuideActivity.java

示例11: onPrepareOptionsMenu

import android.view.Menu; //導入方法依賴的package包/類
@Override
public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();
    // Place an action bar item for searching.
    if (MAVApplication.getInstance().getRepository().isFavorite(mAnimeUrl))
        menu.add(Menu.NONE, mItemBaseID, 0, R.string.favorite).setIcon(ThemeManager.getInstance(getActivity()).isLightBackground()
                ? R.drawable.ic_favorite_black_24dp : R.drawable.ic_favorite_white_24dp);
    else
        menu.add(Menu.NONE, mItemBaseID, 0, R.string.favorite).setIcon(ThemeManager.getInstance(getActivity()).isLightBackground()
                ? R.drawable.ic_favorite_border_black_24dp : R.drawable.ic_favorite_border_white_24dp);
    MenuItemCompat.setShowAsAction(menu.getItem(menu.size() - 1), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    menu.add(Menu.NONE, mItemBaseID + 1, 0, R.string.update)
            .setIcon(ThemeManager.getInstance(getActivity()).isLightBackground() ? R.drawable.ic_refresh_black_24dp : R.drawable.ic_refresh_white_24dp);
    MenuItemCompat.setShowAsAction(menu.getItem(menu.size() - 1), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    MenuItem item = menu.add(Menu.NONE, mItemBaseID + 2, 0, R.string.search_episodes);
    item.setIcon(ThemeManager.getInstance(getActivity()).isLightBackground() ? R.drawable.ic_search_black_24dp : R.drawable.ic_search_white_24dp);
    MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM
            | MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
    mSearchView = new EpisodeSearchView(getActivity());
    mSearchView.setOnQueryTextListener(this);
    mSearchView.setOnCloseListener(this);
    mSearchView.setIconifiedByDefault(true);
    MenuItemCompat.setActionView(item, mSearchView);
    menu.add(Menu.NONE, mItemBaseID + 3, 0, R.string.sort_episodes).setIcon(android.R.drawable.ic_menu_sort_alphabetically);
    MenuItemCompat.setShowAsAction(menu.getItem(menu.size() - 1), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    menu.add(Menu.NONE, mItemBaseID + 4, 0, R.string.download).setIcon(ThemeManager.getInstance(getActivity()).isLightBackground() ? R.drawable.ic_file_download_black_24dp : R.drawable.ic_file_download_white_24dp);
    menu.add(Menu.NONE, mItemBaseID + 5, 0, R.string.mark_viewed);
    menu.add(Menu.NONE, mItemBaseID + 6, 0, R.string.mark_unviewed);
    //menu.add(Menu.NONE, mItemBaseID + 9, 0, "Show/Hide Viewed Episodes");
    //menu.add(Menu.NONE, mItemBaseID + 10, 0, R.string.share);
    //menu.add(Menu.NONE, mItemBaseID + 11, 0, "Find Alternate Sources");
}
 
開發者ID:SalmanTKhan,項目名稱:MyAnimeViewer,代碼行數:33,代碼來源:AnimeMaterialListFragment.java

示例12: onCreateOptionsMenu

import android.view.Menu; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.clear();
    MenuItem help = menu.add(
            Menu.NONE, R.id.menu_id_targeted_help, Menu.NONE, R.string.menu_help);
    help.setIcon(R.drawable.ic_help_and_feedback);
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:8,代碼來源:PrivacyPreferences.java

示例13: onPrepareOptionsMenu

import android.view.Menu; //導入方法依賴的package包/類
@Override
public void onPrepareOptionsMenu(Menu menu) {
    int mItemBaseID = 9600;
    menu.clear();
    menu.add(Menu.NONE, mItemBaseID, 1, R.string.sort)
            .setIcon(ThemeManager.getInstance(getActivity()).isLightBackground() ? R.drawable.ic_sort_by_alpha_black_24dp : R.drawable.ic_sort_by_alpha_white_24dp);
    MenuItemCompat.setShowAsAction(menu.getItem(menu.size() - 1), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    menu.add(Menu.NONE, mItemBaseID + 1, 2, R.string.update)
            .setIcon(ThemeManager.getInstance(getActivity()).isLightBackground() ? R.drawable.ic_refresh_black_24dp : R.drawable.ic_refresh_white_24dp);
    MenuItemCompat.setShowAsAction(menu.getItem(menu.size() - 1), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    menu.add(Menu.NONE, mItemBaseID + 2, 3, R.string.filter)
            .setIcon(ThemeManager.getInstance(getActivity()).isLightBackground() ? R.drawable.ic_filter_list_black_24dp : R.drawable.ic_filter_list_white_24dp);
    MenuItemCompat.setShowAsAction(menu.getItem(menu.size() - 1), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    menu.add(Menu.NONE, mItemBaseID, 0, mDisplayType != Constants.DISPLAY_TYPE_LIST_LARGE ? "List" : "Grid").setIcon(mDisplayType != Constants.DISPLAY_TYPE_LIST_LARGE ? R.drawable.ic_view_list_white_24dp : R.drawable.ic_view_module_white_24dp);
    MenuItemCompat.setShowAsAction(menu.getItem(menu.size() - 1), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    menu.add(Menu.NONE, mItemBaseID, 0, "Columns").setIcon(R.drawable.ic_view_column_white_24dp);
    MenuItemCompat.setShowAsAction(menu.getItem(menu.size() - 1), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
    //menu.add(Menu.NONE, mItemBaseID + 3, 3, R.string.customize_tags);
    //MenuItemCompat.setShowAsAction(menu.getItem(menu.size() - 1), MenuItemCompat.SHOW_AS_ACTION_NEVER);
    //menu.add(Menu.NONE, mItemBaseID + 4, 4, R.string.import_favorites);
    //MenuItemCompat.setShowAsAction(menu.getItem(menu.size() - 1), MenuItemCompat.SHOW_AS_ACTION_NEVER);
    //menu.add(Menu.NONE, mItemBaseID + 5, 5, R.string.export_favorites);
    //MenuItemCompat.setShowAsAction(menu.getItem(menu.size() - 1), MenuItemCompat.SHOW_AS_ACTION_NEVER);
    //menu.add(Menu.NONE, mItemBaseID + 4, 5, R.string.filter).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    //menu.add(Menu.NONE, mItemBaseID + 13, 13, R.string.clear_all_favorites);
    //MenuItemCompat.setShowAsAction(menu.getItem(menu.size() - 1), MenuItemCompat.SHOW_AS_ACTION_NEVER);
}
 
開發者ID:SalmanTKhan,項目名稱:MyAnimeViewer,代碼行數:28,代碼來源:FavoritesFragment.java

示例14: onPrepareOptionsMenu

import android.view.Menu; //導入方法依賴的package包/類
@Override
  public boolean onPrepareOptionsMenu(Menu menu) {
      menu.clear(); //Clear view of previous menu
menu.add(0, ITEM0, 0, getString(R.string.menu_help));
      return super.onPrepareOptionsMenu(menu);

  }
 
開發者ID:woshiwpa,項目名稱:SmartMath,代碼行數:8,代碼來源:ActivityQuickRecog.java

示例15: onCreateOptionsMenu

import android.view.Menu; //導入方法依賴的package包/類
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
    Log.i("ListValuesFragment", "Fragment type in onCreateOptionsMenu(): " + type.name());
    menu.clear();
    menuInflater.inflate(R.menu.menu_delete_value_toolbar, menu);
    super.onCreateOptionsMenu(menu, menuInflater);
}
 
開發者ID:kflauri2312lffds,項目名稱:Android_watch_magpie,代碼行數:8,代碼來源:ListValuesFragment.java


注:本文中的android.view.Menu.clear方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。