android.support.v7.widget.Toolbar.showOverflowMenu()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(100)

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

Toolbar.showOverflowMenu介绍

暂无

代码示例

代码示例来源:origin: yiyibb/Zhihu

private void switchFragment(String type, String title, int id) {
  mCommonFragment.TYPE = type;
  mCommonFragment.themeId = id;
  if (type.equals(Constants.StoryType.STORY_HOME)) {
    mtoolBar.getMenu().findItem(R.id.action_follow).setVisible(false);
    mtoolBar.getMenu().findItem(R.id.action_notice).setVisible(true);
    mtoolBar.getMenu().findItem(R.id.action_switch_model).setVisible(true);
    mtoolBar.getMenu().findItem(R.id.action_config).setVisible(true);
    mtoolBar.hideOverflowMenu();
  } else {
    mtoolBar.getMenu().findItem(R.id.action_follow).setVisible(true);
    mtoolBar.getMenu().findItem(R.id.action_notice).setVisible(false);
    mtoolBar.getMenu().findItem(R.id.action_switch_model).setVisible(false);
    mtoolBar.getMenu().findItem(R.id.action_config).setVisible(false);
    mtoolBar.showOverflowMenu();
  }
  mtoolBar.setTitle(title);
  toFragment(mCommonFragment);
  if (mCommonFragment.isAdded()) {
    mCommonFragment.getData();
  }
}

代码示例来源:origin: tranquvis/SimpleSmsRemote

/**
 * update visible information of help overlay
 *
 * @param helpView current help view
 */
private void updateHelpView(HelpOverlay.View helpView) {
  helpInfoTitleTextView.setText(helpView.getTitleRes());
  helpInfoDescTextView.setText(helpView.getDescRes());
  if (helpView.getHintContainerResId() >= 0)
    findViewById(helpView.getHintContainerResId()).setVisibility(View.VISIBLE);
  if (helpViewPos == 0) {
    //first
    helpNextButton.setText(R.string.help_take_a_tour);
  } else {
    if (helpViewPos == helpOverlay.getHelpViewCount() - 1) {
      //last help view
      helpNextButton.setText(R.string.help_how_to_control_title);
    } else
      helpNextButton.setText(R.string.help_next);
    if (helpView.getTitleRes() == R.string.help_other_title) {
      toolbar.showOverflowMenu();
    } else {
      toolbar.hideOverflowMenu();
    }
  }
}

代码示例来源:origin: AEFeinstein/mtg-familiar

/**
 * Called when a key was released and not handled by any of the views inside of the activity.
 * So, for example, key presses while the cursor is inside a TextView will not trigger the event
 * (unless it is a navigation to another object) because TextView handles its own key presses.
 * The default implementation handles KEYCODE_BACK to stop the activity and go back.
 * This has a dinky workaround for LG phones
 *
 * @param keyCode The value in event.getKeyCode().
 * @param event   Description of the key event.
 * @return If you handled the event, return true. If you want to allow the event to be handled
 * by the next receiver, return false.
 */
@Override
public boolean onKeyUp(int keyCode, @NotNull KeyEvent event) {
  if (keyCode == KeyEvent.KEYCODE_MENU) {
    Toolbar toolbar = findViewById(R.id.toolbar);
    if (toolbar != null) {
      if (toolbar.isOverflowMenuShowing()) {
        toolbar.dismissPopupMenus();
      } else {
        toolbar.showOverflowMenu();
      }
    }
    return true;
  }
  return super.onKeyUp(keyCode, event);
}

相关文章

Toolbar类方法