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

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

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

PopupMenu.show介绍

暂无

代码示例

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

@Override
  public void show() {
    mSupportPopupMenu.show();
  }
}

代码示例来源:origin: aa112901/remusic

popupMenu.show();

代码示例来源:origin: mancj/MaterialSearchBar

@Override
public void onClick(View v) {
  int id = v.getId();
  if (id == getId()) {
    if (!searchEnabled) {
      enableSearch();
    }
  } else if (id == R.id.mt_arrow) {
    disableSearch();
  } else if (id == R.id.mt_search) {
    if (listenerExists())
      onSearchActionListener.onButtonClicked(BUTTON_SPEECH);
  } else if (id == R.id.mt_clear) {
    searchEdit.setText("");
  } else if (id == R.id.mt_menu) {
    popupMenu.show();
  } else if (id == R.id.mt_nav)
    if (listenerExists()) {
      if (navIconShown) {
        onSearchActionListener.onButtonClicked(BUTTON_NAVIGATION);
      } else {
        onSearchActionListener.onButtonClicked(BUTTON_BACK);
      }
    }
}

代码示例来源:origin: k9mail/k-9

@Override
public void onClick(View view) {
  int id = view.getId();
  if (id == R.id.from) {
    onAddSenderToContacts();
  } else if (id == R.id.to || id == R.id.cc || id == R.id.bcc) {
    expand((TextView)view, ((TextView)view).getEllipsize() != null);
    layoutChanged();
  } else if (id == R.id.crypto_status_icon) {
    onCryptoClickListener.onCryptoClick();
  } else if (id == R.id.icon_single_message_options) {
    PopupMenu popupMenu = new PopupMenu(getContext(), view);
    popupMenu.setOnMenuItemClickListener(onMenuItemClickListener);
    popupMenu.inflate(R.menu.single_message_options);
    popupMenu.show();
  }
}

代码示例来源:origin: iMeiji/Toutiao

popupMenu.show();
});

代码示例来源:origin: iMeiji/Toutiao

popupMenu.show();
});

代码示例来源:origin: iMeiji/Toutiao

popupMenu.show();
});

代码示例来源:origin: iMeiji/Toutiao

popupMenu.show();
  });
} catch (Exception e) {

代码示例来源:origin: iMeiji/Toutiao

popupMenu.show();
});

代码示例来源:origin: iMeiji/Toutiao

popupMenu.show();
  });
} catch (Exception e) {

代码示例来源:origin: iMeiji/Toutiao

popupMenu.show();
  });
} catch (Exception e) {

代码示例来源:origin: seven332/EhViewer

ensurePopMenu();
if (mPopupMenu != null) {
  mPopupMenu.show();

代码示例来源:origin: iMeiji/Toutiao

popupMenu.show();
  });
} catch (Exception e) {

代码示例来源:origin: iMeiji/Toutiao

popupMenu.show();
  });
} catch (Exception e) {

代码示例来源:origin: willowtreeapps/Hyperion-Android

@Override
  public void onClick(final View v) {
    PopupMenu menu = new PopupMenu(itemView.getContext(), options);
    menu.inflate(R.menu.hd_file_options);
    menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
      @Override
      public boolean onMenuItemClick(MenuItem item) {
        final Context context = v.getContext();
        int id = item.getItemId();
        if (id == R.id.share) {
          Intent intent = new Intent(Intent.ACTION_SEND);
          intent.setType(FileViewHolder.this.item.mimeType);
          intent.putExtra(Intent.EXTRA_STREAM, FileViewHolder.this.item.uri);
          context.startActivity(Intent.createChooser(intent, "Share file"));
          return true;
        }
        if (id == R.id.delete) {
          boolean deleted = FileViewHolder.this.item.file.delete();
          if (!deleted) {
            Toast.makeText(context, "Could not delete file.", Toast.LENGTH_LONG).show();
          }
          return true;
        }
        return false;
      }
    });
    menu.show();
  }
});

代码示例来源:origin: willowtreeapps/Hyperion-Android

private void showMenu(View anchor) {
  final Context context = anchor.getContext();
  if (popupMenu != null) {
    popupMenu.dismiss();
  }
  popupMenu = new PopupMenu(context, anchor);
  popupMenu.inflate(R.menu.hgc_menu_options);
  final Menu menu = popupMenu.getMenu();
  final MenuItem areHapticsEnabledItem = menu.findItem(R.id.menu_item_use_haptics);
  areHapticsEnabledItem.setChecked(detector.areHapticsEnabled());
  areHapticsEnabledItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
    @Override
    public boolean onMenuItemClick(MenuItem item) {
      boolean areHapticsEnabled = !item.isChecked();
      item.setChecked(areHapticsEnabled);
      detector.setHapticsEnabled(areHapticsEnabled);
      return true;
    }
  });
  popupMenu.show();
}

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

void showSortingPopup(View v){
    PopupMenu popup = new PopupMenu(getActivity(), v);

    popup.getMenuInflater().inflate(R.menu.popup_menu, popup.getMenu());
    popup.getMenu().add(0, SORT_NOSORT, 0, sort_texts[SORT_NOSORT]);
    popup.getMenu().add(0, SORT_ESSID, 1, sort_texts[SORT_ESSID]);
    popup.getMenu().add(0, SORT_BEACONS_FRAMES, 2, sort_texts[SORT_BEACONS_FRAMES]);
    popup.getMenu().add(0, SORT_DATA_FRAMES, 3, sort_texts[SORT_DATA_FRAMES]);
    popup.getMenu().add(0, SORT_PWR, 4, sort_texts[SORT_PWR]);
    popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
      public boolean onMenuItemClick(android.view.MenuItem item) {
        temp_sort = item.getItemId();
        sortSelectBtn.setText(sort_texts[temp_sort]);
        return true;
      }
    });
    popup.show();
  }
}

代码示例来源:origin: ricknout/lens-launcher

@Override
  public void onClick(View view) {
    PopupMenu popupMenu = new PopupMenu(mContext, view);
    popupMenu.setOnMenuItemClickListener(AppViewHolder.this);
    popupMenu.inflate(R.menu.menu_app);
    popupMenu.show();
  }
});

代码示例来源:origin: SecUSo/privacy-friendly-pedometer

public void showPopup(View v, Context c) {
  PopupMenu popup = new PopupMenu(c, v);
  MenuInflater inflater = popup.getMenuInflater();
  inflater.inflate(R.menu.menu_card_training_session, popup.getMenu());
  popup.setOnMenuItemClickListener(this);
  popup.show();
}

代码示例来源:origin: owntracks/android

private void showPopupMenu(View v) {
  PopupMenu popupMenu = new PopupMenu(this, v, Gravity.START); //new PopupMenu(this, v);
  popupMenu.getMenuInflater().inflate(R.menu.menu_popup_contacts, popupMenu.getMenu());
  popupMenu.setOnMenuItemClickListener(this);
  if (preferences.getModeId() == MessageProcessorEndpointHttp.MODE_ID)
    popupMenu.getMenu().removeItem(R.id.menu_clear);
  popupMenu.show();
}

相关文章