android.app.Activity.onPrepareOptionsMenu()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中android.app.Activity.onPrepareOptionsMenu()方法的一些代码示例,展示了Activity.onPrepareOptionsMenu()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.onPrepareOptionsMenu()方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:onPrepareOptionsMenu

Activity.onPrepareOptionsMenu介绍

暂无

代码示例

代码示例来源:origin: evernote/android-job

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  super.onPrepareOptionsMenu(menu);

代码示例来源:origin: bitstadium/HockeySDK-Android

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  super.onPrepareOptionsMenu(menu);
  return true;
}

代码示例来源:origin: com.uphyca/android-junit4-robolectric

/**
 * @param menu
 * @return
 * @see android.app.Activity#onPrepareOptionsMenu(android.view.Menu)
 */
public boolean onPrepareOptionsMenu(Menu menu) {
  return mActivity.onPrepareOptionsMenu(menu);
}

代码示例来源:origin: iqiyi/Neptune

@Override
public boolean onPrepareOptionsMenu(android.view.Menu menu0) {
  return mOriginActivity.onPrepareOptionsMenu(menu0);
}

代码示例来源:origin: dogriffiths/HeadFirstAndroid

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  // If the drawer is open, hide action items related to the content view
  boolean drawerOpen = drawerLayout.isDrawerOpen(drawerList);
  menu.findItem(R.id.action_share).setVisible(!drawerOpen);
  return super.onPrepareOptionsMenu(menu);
}

代码示例来源:origin: googlesamples/android-NavigationDrawer

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  // If the nav drawer is open, hide action items related to the content view
  boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList);
  menu.findItem(R.id.action_websearch).setVisible(!drawerOpen);
  return super.onPrepareOptionsMenu(menu);
}

代码示例来源:origin: google/ringdroid

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  super.onPrepareOptionsMenu(menu);
  menu.findItem(R.id.action_save).setVisible(true);
  menu.findItem(R.id.action_reset).setVisible(true);
  menu.findItem(R.id.action_about).setVisible(true);
  return true;
}

代码示例来源:origin: nbenm/ImapNote2

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  MenuItem item= menu.findItem(R.id.color);
  super.onPrepareOptionsMenu(menu);
  //depending on your conditions, either enable/disable
  if (this.usesticky.equals("true")) {
      item.setVisible(true);
  } else {
      item.setVisible(false);
  }
  menu.findItem(this.realColor).setChecked(true);
  return true;
}

代码示例来源:origin: maisi/M365-Power

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  if (mIsScanning) {
    menu.findItem(R.id.action_scan).setVisible(false);
    menu.findItem(R.id.action_stop).setVisible(true);
  } else {
    menu.findItem(R.id.action_scan).setVisible(true);
    menu.findItem(R.id.action_stop).setVisible(false);
  }
  return super.onPrepareOptionsMenu(menu);
}

代码示例来源:origin: labexp/osmtracker-android

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  menu.findItem(R.id.displaytrackmap_menu_center_to_gps).setEnabled( (!centerToGpsPos && currentPosition != null ) );
  return super.onPrepareOptionsMenu(menu);
}

代码示例来源:origin: klinker24/Android-Blur-Launcher

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  super.onPrepareOptionsMenu(menu);
  if (mLauncherCallbacks != null) {
    return mLauncherCallbacks.onPrepareOptionsMenu(menu);
  }
  return false;
}

代码示例来源:origin: klinker24/launcher3

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  super.onPrepareOptionsMenu(menu);
  if (mLauncherCallbacks != null) {
    return mLauncherCallbacks.onPrepareOptionsMenu(menu);
  }
  return false;
}

代码示例来源:origin: ianhanniballake/TripleSolitaire

/**
 * Method called every time the options menu is invalidated/repainted. Shows/hides the sign out button
 *
 * @see android.app.Activity#onPrepareOptionsMenu(android.view.Menu)
 */
@Override
public boolean onPrepareOptionsMenu(final Menu menu) {
  super.onPrepareOptionsMenu(menu);
  menu.findItem(R.id.sign_out).setVisible(GoogleSignIn.getLastSignedInAccount(this) != null);
  return true;
}

代码示例来源:origin: THEONE10211024/ApiDemos

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  if (mSortMode != -1) {
    Drawable icon = menu.findItem(mSortMode).getIcon();
    menu.findItem(R.id.action_sort).setIcon(icon);
  }
  return super.onPrepareOptionsMenu(menu);
}

代码示例来源:origin: qiubiteme/android_api_demos

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  if (mSortMode != -1) {
    Drawable icon = menu.findItem(mSortMode).getIcon();
    menu.findItem(R.id.action_sort).setIcon(icon);
  }
  return super.onPrepareOptionsMenu(menu);
}

代码示例来源:origin: shazam/android-aspects

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  return super.onPrepareOptionsMenu(menu) || dispatcher.dispatchOnPrepareOptionsMenu(this, menu);
}

代码示例来源:origin: tcoxon/XkcdViewer

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  super.onPrepareOptionsMenu(menu);
  menu.findItem(R.id.MENU_HOVER_TEXT).
      setVisible(comicDef.hasAltText());
  menu.findItem(R.id.MENU_COMIC_LINK).
      setVisible(comicInfo.getLink() != null);
  menu.findItem(R.id.MENU_EXPLAIN).
      setVisible(provider.getExplainUrl(comicInfo) != null);
  return true;
}

代码示例来源:origin: org.openmobster.core.mobileCloud.android.2_0/native-framework

@Override
public boolean onPrepareOptionsMenu(Menu menu)
{                
  menu.clear();
  super.onPrepareOptionsMenu(menu);
  
  return CommonApp.onPrepareOptionsMenu(this, menu);
}

代码示例来源:origin: vanilla-music/vanilla

/**
 * Opens the OptionsMenu of this view
 */
public void openMenu() {
  if (mPopupMenu == null || mParentMenuConsumer == null)
    return;
  mParentMenuConsumer.onPrepareOptionsMenu(mPopupMenu.getMenu());
  mPopupMenu.show();
}

代码示例来源:origin: ianhanniballake/TripleSolitaire

/**
 * Method called every time the options menu is invalidated/repainted. Enables/disables the undo button
 *
 * @see android.app.Activity#onPrepareOptionsMenu(android.view.Menu)
 */
@Override
public boolean onPrepareOptionsMenu(final Menu menu) {
  super.onPrepareOptionsMenu(menu);
  menu.findItem(R.id.undo).setEnabled(gameState.canUndo());
  final boolean gameStarted = gameState.getTimeInSeconds() > 0;
  final boolean gameInProgress = gameState.gameInProgress;
  menu.findItem(R.id.pause).setEnabled(gameStarted || gameInProgress);
  return true;
}

相关文章

Activity类方法