当前位置: 首页>>代码示例>>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;未经允许,请勿转载。