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

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

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

PopupMenu.getMenuInflater介绍

暂无

代码示例

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

PopupMenu popup = new PopupMenu(getContext(), mImageButton);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.your_menu, popup.getMenu());

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

PopupMenu popup = new PopupMenu(getContext(), mImageButton);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(......);

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

@Override
public void onItemClick(AdapterView<?> adapterView, View view, final int index, long l){
  PopupMenu popup = new PopupMenu(getActivity(), view);
  popup.getMenuInflater().inflate(R.menu.popup_menu, popup.getMenu());

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

void onSelectClick(View view){
  PopupMenu popup = new PopupMenu(getActivity(), view);
  popup.getMenuInflater().inflate(R.menu.popup_menu, popup.getMenu());
  int i = 0;
  for(AP ap : AP.APs){

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

void showTargetSelector(){
  PopupMenu popup = new PopupMenu(getActivity(), targetBtn);
  popup.getMenuInflater().inflate(R.menu.popup_menu, popup.getMenu());

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

PopupMenu popup = new PopupMenu(getActivity(), view);
popup.getMenuInflater().inflate(R.menu.popup_menu, popup.getMenu());
int i = 0;
for(AP ap : AP.APs){

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

protected void showPopupMenu(View v, int size){
  //create instance
  PopupMenu popup = new PopupMenu(Activity.this,v);
  //inflating the popup using xml
  popup.getMenuInflater().inflate(R.menu.menu_popup_list),popup.getMenu());

for(int i=0;i<size;i++){
 popmenu.getMenu().add(0,i+99,0,"text").setcheckable(true).setChecked(false);
}
}

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

PopupMenu getPopupMenu(final MainActivity activity, final View v){
  PopupMenu popup = new PopupMenu(activity, v);
  popup.getMenuInflater().inflate(R.menu.popup_menu, popup.getMenu());

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

showPopup(viewOfWherePopupmenuShows,popmenuNameList.size());

PopupMenu popMenu = new PopupMenu(Activity.this,v)
int size =popmenuNameList.size();
for(int i =0; i <size; i++){
 popMenu.getMenu().add(popmenuNameList.get(i)).setIcon(R.drawable.logo);

}
 popMenu.show();

protected void showPopupMenu(View v, int size){
  //create instance
  PopupMenu popup = new PopupMenu(Activity.this,v);
  //inflating the popup using xml
  popup.getMenuInflater().inflate(R.menu.menu_popup_list),popup.getMenu());
}

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

popup2.getMenuInflater().inflate(R.menu.popup_menu, popup2.getMenu());

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

PopupMenu popup = new PopupMenu(YourActivity.this, 
                controlNearDisplayAreaOfMenu);
Menu menu = popup.getMenu();
popup.getMenuInflater().inflate(R.menu.menu_layout_for_popup, menu);
     popup.setOnMenuItemClickListener(new OverflowMenuHandler());

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

PopupMenu getPopupMenu(final MainActivity activity, final View v){
  PopupMenu popup = new PopupMenu(activity, v);
  popup.getMenuInflater().inflate(R.menu.popup_menu, popup.getMenu());

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

final PopupMenu popup = new PopupMenu(MainActivity.this, buttonInventory);

popup.getMenuInflater().inflate(R.menu.popup_menu, popup.getMenu());

for(Weapon weapon: player.getWeapons()){
    popup.getMenu().add(WEAPON_ID,Menu.NONE,Menu.NONE,weapon.getName());
  }  //this adds the weapons to the WEAPON_ID group

代码示例来源:origin: Leaking/WeGit

public void setOverflowMenu(@MenuRes int overflowMenuResId) {
  overflow.setVisibility(VISIBLE);
  popupMenu = new PopupMenu(context, overflow);
  popupMenu.getMenuInflater().inflate(overflowMenuResId, popupMenu.getMenu());
}

代码示例来源:origin: Mavamaarten/vk_music_android

private void showPopupMenu(View v, VKApiAudio audio) {
    PopupMenu menu = new PopupMenu(v.getContext(), v);
    menu.getMenuInflater().inflate(R.menu.menu_audio_options, menu.getMenu());
    menu.getMenu().findItem(R.id.action_remove_from_playlist).setVisible(isPlaylist);
    menu.getMenu().findItem(R.id.action_remove_from_my_audio).setVisible(isMyAudio);
    menu.setOnMenuItemClickListener(item -> listener.onAudioMenuItemClicked(audio, getAdapterPosition(), item.getItemId()));
    menu.show();
  }
}

代码示例来源:origin: THEONE10211024/ApiDemos

public void onPopupButtonClick(View button) {
    PopupMenu popup = new PopupMenu(this, button);
    popup.getMenuInflater().inflate(R.menu.popup, popup.getMenu());

    popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
      public boolean onMenuItemClick(MenuItem item) {
        Toast.makeText(PopupMenu1.this, "Clicked popup menu item " + item.getTitle(),
            Toast.LENGTH_SHORT).show();
        return true;
      }
    });

    popup.show();
  }
}

代码示例来源:origin: qiubiteme/android_api_demos

public void onPopupButtonClick(View button) {
    PopupMenu popup = new PopupMenu(this, button);
    popup.getMenuInflater().inflate(R.menu.popup, popup.getMenu());

    popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
      public boolean onMenuItemClick(MenuItem item) {
        Toast.makeText(PopupMenu1.this, "Clicked popup menu item " + item.getTitle(),
            Toast.LENGTH_SHORT).show();
        return true;
      }
    });

    popup.show();
  }
}

代码示例来源:origin: edgarvperes/HayaiLauncher

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

代码示例来源:origin: gigabytedevelopers/FireFiles

private void showPopupMenu(View view, final int position) {
  PopupMenu popup = new PopupMenu(getActivity(), view);
  popup.getMenuInflater().inflate(R.menu.popup_connections, popup.getMenu());
  popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
    @Override
    public boolean onMenuItemClick(MenuItem menuItem) {
      return onPopupMenuItemClick(menuItem, position);
    }
  });
  popup.show();
}

相关文章