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

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

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

PopupMenu.setOnMenuItemClickListener介绍

暂无

代码示例

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

@Override
public PopupMenu setOnMenuItemClickListener(final OnMenuItemClickListener listener) {
  mSupportPopupMenu.setOnMenuItemClickListener(listener::onMenuItemClick);
  return this;
}

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

@Override
public void onClick(View v) {
  PopupMenu popupMenu = new PopupMenu(mContext, v);
  popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
    @Override
    public boolean onMenuItemClick(MenuItem item) {

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

mPopupMenu = popup;
popup.getMenuInflater().inflate(R.menu.scene_gallery_detail, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
  @Override
  public boolean onMenuItemClick(MenuItem item) {

代码示例来源: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

holder.iv_dots, Gravity.END, 0, R.style.MyPopupMenu);
popupMenu.inflate(R.menu.menu_share);
popupMenu.setOnMenuItemClickListener(menu -> {
  int itemId = menu.getItemId();
  if (itemId == R.id.action_share) {

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

holder.iv_dots, Gravity.END, 0, R.style.MyPopupMenu);
popupMenu.inflate(R.menu.menu_share);
popupMenu.setOnMenuItemClickListener(menu -> {
  int itemId = menu.getItemId();
  if (itemId == R.id.action_share) {

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

holder.iv_dots, Gravity.END, 0, R.style.MyPopupMenu);
popupMenu.inflate(R.menu.menu_share);
popupMenu.setOnMenuItemClickListener(menu -> {
  int itemId = menu.getItemId();
  if (itemId == R.id.action_share) {

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

holder.iv_dots, Gravity.END, 0, R.style.MyPopupMenu);
popupMenu.inflate(R.menu.menu_share);
popupMenu.setOnMenuItemClickListener(menu -> {
  int itemId = menu.getItemId();
  if (itemId == R.id.action_share) {

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

holder.iv_dots, Gravity.END, 0, R.style.MyPopupMenu);
popupMenu.inflate(R.menu.menu_share);
popupMenu.setOnMenuItemClickListener(menu -> {
  int itemId = menu.getItemId();
  if (itemId == R.id.action_share) {

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

holder.iv_dots, Gravity.END, 0, R.style.MyPopupMenu);
popupMenu.inflate(R.menu.menu_share);
popupMenu.setOnMenuItemClickListener(menu -> {
  int itemId = menu.getItemId();
  if (itemId == R.id.action_share) {

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

holder.iv_dots, Gravity.END, 0, R.style.MyPopupMenu);
popupMenu.inflate(R.menu.menu_share);
popupMenu.setOnMenuItemClickListener(menu -> {
  int itemId = menu.getItemId();
  if (itemId == R.id.action_share) {

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

holder.iv_dots, Gravity.END, 0, R.style.MyPopupMenu);
popupMenu.inflate(R.menu.menu_share);
popupMenu.setOnMenuItemClickListener(menu -> {
  int itemId = menu.getItemId();
  if (itemId == R.id.action_share) {

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

holder.iv_dots, Gravity.END, 0, R.style.MyPopupMenu);
popupMenu.inflate(R.menu.menu_share);
popupMenu.setOnMenuItemClickListener(menu -> {
  int itemId = menu.getItemId();
  if (itemId == R.id.action_share) {

代码示例来源: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: 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: yydcdut/RxMarkdown

@Override
public void onClick(View v) {
  PopupMenu popup = new PopupMenu(getContext(), mTargetImageView);
  MenuInflater inflater = popup.getMenuInflater();
  inflater.inflate(R.menu.menu_popup, popup.getMenu());
  popup.setOnMenuItemClickListener(this);
  popup.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_activity_summary, popup.getMenu());
  popup.setOnMenuItemClickListener(this);
  if (mItemClickListener != null) {
    mItemClickListener.setActivityChartDataTypeChecked(popup.getMenu());
  }
  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();
}

相关文章