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

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

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

PopupMenu.<init>介绍

暂无

代码示例

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

@Override
public PopupMenu create(Context context, View anchor, int gravity) {
  mSupportPopupMenu = new android.support.v7.widget.PopupMenu(context, anchor, gravity);
  return this;
}

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

private void inflateMenuRequest(int menuResource, int iconResId
) {
  int menuResource1 = menuResource;
  if (menuResource1 > 0) {
    ImageView menuIcon = findViewById(R.id.mt_menu);
    if (iconResId != -1) {
      menuIconRes = iconResId;
      menuIcon.setImageResource(menuIconRes);
    }
    RelativeLayout.LayoutParams params = (LayoutParams) searchIcon.getLayoutParams();
    params.rightMargin = (int) (48 * destiny);
    searchIcon.setLayoutParams(params);
    menuIcon.setVisibility(VISIBLE);
    menuIcon.setOnClickListener(this);
    popupMenu = new PopupMenu(getContext(), menuIcon);
    popupMenu.inflate(menuResource);
    popupMenu.setGravity(Gravity.RIGHT);
  }
}

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

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

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

PopupMenu popup = new PopupMenu(context, mOtherActions, Gravity.TOP);
mPopupMenu = popup;
popup.getMenuInflater().inflate(R.menu.scene_gallery_detail, popup.getMenu());

代码示例来源: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.tv_extra.setText(tv_source + " - " + tv_comment_count + " - " + tv_datetime);
holder.iv_dots.setOnClickListener(view -> {
  PopupMenu popupMenu = new PopupMenu(context,
      holder.iv_dots, Gravity.END, 0, R.style.MyPopupMenu);
  popupMenu.inflate(R.menu.menu_share);

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

holder.tv_extra.setText(tv_source + " - " + tv_comment_count + " - " + tv_datetime);
holder.iv_dots.setOnClickListener(view -> {
  PopupMenu popupMenu = new PopupMenu(context,
      holder.iv_dots, Gravity.END, 0, R.style.MyPopupMenu);
  popupMenu.inflate(R.menu.menu_share);

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

holder.tv_video_time.setText(tv_video_time);
holder.iv_dots.setOnClickListener(view -> {
  PopupMenu popupMenu = new PopupMenu(context,
      holder.iv_dots, Gravity.END, 0, R.style.MyPopupMenu);
  popupMenu.inflate(R.menu.menu_share);

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

});
holder.iv_dots.setOnClickListener(view -> {
  PopupMenu popupMenu = new PopupMenu(context,
      holder.iv_dots, Gravity.END, 0, R.style.MyPopupMenu);
  popupMenu.inflate(R.menu.menu_share);

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

holder.tv_extra.setText(tv_source + " - " + comments_count + " - " + tv_datetime);
holder.iv_dots.setOnClickListener(view -> {
  PopupMenu popupMenu = new PopupMenu(context,
      holder.iv_dots, Gravity.END, 0, R.style.MyPopupMenu);
  popupMenu.inflate(R.menu.menu_share);

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

});
holder.iv_dots.setOnClickListener(view -> {
  PopupMenu popupMenu = new PopupMenu(context,
      holder.iv_dots, Gravity.END, 0, R.style.MyPopupMenu);
  popupMenu.inflate(R.menu.menu_share);

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

PopupMenu popupMenu = new PopupMenu(context,
    holder.iv_dots, Gravity.END, 0, R.style.MyPopupMenu);
popupMenu.inflate(R.menu.menu_share);

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

PopupMenu popupMenu = new PopupMenu(context,
    holder.iv_dots, Gravity.END, 0, R.style.MyPopupMenu);
popupMenu.inflate(R.menu.menu_share);

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

PopupMenu popupMenu = new PopupMenu(context,
    holder.iv_dots, Gravity.END, 0, R.style.MyPopupMenu);
popupMenu.inflate(R.menu.menu_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: 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();
}

相关文章