本文整理汇总了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);
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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");
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}