android.widget.PopupMenu.setOnMenuItemClickListener()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(155)

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

PopupMenu.setOnMenuItemClickListener介绍

暂无

代码示例

代码示例来源:origin: robolectric/robolectric

@Implementation
protected void setOnMenuItemClickListener(PopupMenu.OnMenuItemClickListener listener) {
 this.onMenuItemClickListener = listener;
 directlyOn(realPopupMenu, PopupMenu.class).setOnMenuItemClickListener(listener);
}

代码示例来源:origin: hidroh/materialistic

@SuppressLint("NewApi")
@Override
public PopupMenu setOnMenuItemClickListener(final OnMenuItemClickListener listener) {
  popupMenu.setOnMenuItemClickListener(new android.widget.PopupMenu.OnMenuItemClickListener() {
    @Override
    public boolean onMenuItemClick(MenuItem item) {
      return listener.onMenuItemClick(item);
    }
  });
  return this;
}

代码示例来源:origin: TeamNewPipe/NewPipe

private PopupMenu buildPopup(final View button) {
    PopupMenu popup = new PopupMenu(mContext, button);
    popup.inflate(R.menu.mission);
    popup.setOnMenuItemClickListener(option -> handlePopupItem(this, option));
    return popup;
  }
}

代码示例来源:origin: naman14/Timber

menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
  @Override
  public boolean onMenuItemClick(MenuItem item) {

代码示例来源:origin: TeamNewPipe/NewPipe

public void buildQualityMenu() {
  if (qualityPopupMenu == null) return;
  qualityPopupMenu.getMenu().removeGroup(qualityPopupMenuGroupId);
  for (int i = 0; i < availableStreams.size(); i++) {
    VideoStream videoStream = availableStreams.get(i);
    qualityPopupMenu.getMenu().add(qualityPopupMenuGroupId, i, Menu.NONE,
        MediaFormat.getNameById(videoStream.getFormatId()) + " " + videoStream.resolution);
  }
  if (getSelectedVideoStream() != null) {
    qualityTextView.setText(getSelectedVideoStream().resolution);
  }
  qualityPopupMenu.setOnMenuItemClickListener(this);
  qualityPopupMenu.setOnDismissListener(this);
}

代码示例来源:origin: naman14/Timber

menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
  @Override
  public boolean onMenuItemClick(MenuItem item) {

代码示例来源:origin: naman14/Timber

menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
  @Override
  public boolean onMenuItemClick(MenuItem item) {

代码示例来源:origin: naman14/Timber

menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
  @Override
  public boolean onMenuItemClick(MenuItem item) {

代码示例来源:origin: naman14/Timber

menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
  @Override
  public boolean onMenuItemClick(MenuItem item) {

代码示例来源:origin: naman14/Timber

menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
  @Override
  public boolean onMenuItemClick(MenuItem item) {

代码示例来源:origin: TeamNewPipe/NewPipe

private void buildPlaybackSpeedMenu() {
  if (playbackSpeedPopupMenu == null) return;
  playbackSpeedPopupMenu.getMenu().removeGroup(playbackSpeedPopupMenuGroupId);
  for (int i = 0; i < PLAYBACK_SPEEDS.length; i++) {
    playbackSpeedPopupMenu.getMenu().add(playbackSpeedPopupMenuGroupId, i, Menu.NONE, formatSpeed(PLAYBACK_SPEEDS[i]));
  }
  playbackSpeedTextView.setText(formatSpeed(getPlaybackSpeed()));
  playbackSpeedPopupMenu.setOnMenuItemClickListener(this);
  playbackSpeedPopupMenu.setOnDismissListener(this);
}

代码示例来源:origin: robolectric/robolectric

@Test
 public void getOnClickListener_returnsOnClickListener() throws Exception {
  assertThat(shadowOf(popupMenu).getOnMenuItemClickListener()).isNull();

  PopupMenu.OnMenuItemClickListener listener = new PopupMenu.OnMenuItemClickListener() {
   @Override
   public boolean onMenuItemClick(MenuItem menuItem) {
    return false;
   }
  };
  popupMenu.setOnMenuItemClickListener(listener);

  assertThat(shadowOf(popupMenu).getOnMenuItemClickListener()).isEqualTo(listener);
 }
}

代码示例来源:origin: stackoverflow.com

PopupMenu menu = new PopupMenu(getContext(), overflowImageView);
menu.inflate(R.menu.popup);
menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { ... });

MenuPopupHelper menuHelper = new MenuPopupHelper(getContext(), (MenuBuilder) menu.getMenu(), overflowImageView);
menuHelper.setForceShowIcon(true);
menuHelper.show();

代码示例来源:origin: julian-klode/dns66

PopupMenu menu = new PopupMenu(getContext(), rootView.findViewById(R.id.change_default));
menu.inflate(R.menu.whitelist_popup);
menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
  @Override
  public boolean onMenuItemClick(MenuItem item) {

代码示例来源:origin: chrisk44/Hijacker

void showActionSelector(){
  PopupMenu popup = new PopupMenu(getActivity(), actionBtn);
  popup.getMenuInflater().inflate(R.menu.popup_menu, popup.getMenu());
  //add(groupId, itemId, order, title)
  int i;
  for(i=0;i<cmds.size();i++){
    popup.getMenu().add(cmds.get(i).getType(), i, i, cmds.get(i).getTitle());
  }
  popup.getMenu().add(-1, 0, i+1, getString(R.string.manage_actions));
  popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
    public boolean onMenuItemClick(android.view.MenuItem item){
      if(item.getGroupId()==-1){
        //Open actions manager
        FragmentTransaction ft = mFragmentManager.beginTransaction();
        ft.replace(R.id.fragment1, new CustomActionManagerFragment());
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
        ft.addToBackStack(null);
        ft.commitAllowingStateLoss();
      }else{
        onActionSelected(cmds.get(item.getItemId()));
      }
      return true;
    }
  });
  popup.show();
}
void showTargetSelector(){

代码示例来源:origin: chrisk44/Hijacker

popup.getMenu().add(0, 1, 1, getString(R.string.delete));
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
  public boolean onMenuItemClick(android.view.MenuItem item){
    switch(item.getItemId()){

代码示例来源:origin: chrisk44/Hijacker

popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
  public boolean onMenuItemClick(android.view.MenuItem item) {

代码示例来源:origin: chrisk44/Hijacker

popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){
  public boolean onMenuItemClick(android.view.MenuItem item){
    switch(item.getGroupId()){

代码示例来源:origin: chrisk44/Hijacker

popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
  public boolean onMenuItemClick(android.view.MenuItem item) {

代码示例来源:origin: Neamar/KISS

popupExcludeMenu.getMenu().add(EXCLUDE_KISS_ID,Menu.NONE, Menu.NONE,R.string.menu_exclude_kiss);
popupExcludeMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
  public boolean onMenuItemClick(MenuItem item) {
    switch (item.getGroupId()) {

相关文章