android.view.Menu.performIdentifierAction()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(173)

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

暂无

代码示例

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

private Menu mainMenu;

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  // TODO: init menu here...
  // then:
  mainMenu=menu;
  return true;
}

@Override
public boolean onKeyUp(int keycode, KeyEvent e) {
  switch(keycode) {
    case KeyEvent.KEYCODE_MENU:
      if (mainMenu !=null) {
        mainMenu.performIdentifierAction(R.id.menu_overflow, 0);
      }
  }

  return super.onKeyUp(keycode, e);
}

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

@Override
 public boolean onCreateOptionsMenu(Menu menu) {
   MenuInflater inflater = getMenuInflater();
   inflater.inflate(R.menu.actionbarhelpmenu, menu);
   final Menu m = menu;
   final MenuItem item = menu.findItem(R.id.ActionConnection);
   item.getActionView().setOnClickListener(new OnClickListener() {
     @Override
     public void onClick(View v) {   
       m.performIdentifierAction(item.getItemId(), 0);
     }
   });
   return true;
 }

代码示例来源:origin: com.actionbarsherlock/actionbarsherlock

@Override
public boolean performIdentifierAction(int id, int flags) {
  return mNativeMenu.performIdentifierAction(id, flags);
}

代码示例来源:origin: com.willowtreeapps/oak-demos

@Override
public boolean performIdentifierAction(int id, int flags) {
  return mNativeMenu.performIdentifierAction(id, flags);
}

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

Menu bottomNavigationMenu = myBottomNavigationMenu.getMenu();
bottomNavigationMenu.performIdentifierAction(selected_menu_item_id, 0);

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

private Menu mainMenu;    

...

@Override
  public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (event.getAction() == KeyEvent.ACTION_UP) {
      switch (keyCode) {
      case KeyEvent.KEYCODE_MENU:

        mainMenu.performIdentifierAction(R.id.menu_more, 0);
        return true;
      }

    }
    return super.onKeyUp(keyCode, event);
  }

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

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  // Inflate the menu; this adds items to the action bar if it is present.
  getMenuInflater().inflate(R.menu.orders, menu);
  final Menu m = menu;
  refreshItem = menu.findItem(R.id.action_refresh);
  refreshItem.getActionView().setOnClickListener(new OnClickListener() {
          @Override
          public void onClick(View v) {   
            m.performIdentifierAction(refreshItem.getItemId(), 0);
          }
      });
  return true;
}

代码示例来源:origin: ukanth/afwall

case KeyEvent.KEYCODE_MENU:
  if (mainMenu != null) {
    mainMenu.performIdentifierAction(R.id.menu_list_item, 0);
    return true;

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

@Override
public boolean onCreateOptionsMenu(Menu menu) 
{
  getMenuInflater().inflate(R.menu.orders, menu);

  final Menu m = menu;
  refreshItem = menu.findItem(R.id.action_refresh);
  refreshItem.getActionView().setOnClickListener(new OnClickListener() 
  {
   @Override
   public void onClick(View v) 
   {   
     m.performIdentifierAction(refreshItem.getItemId(), 0);
     rotation = AnimationUtils.loadAnimation(this, R.anim.clockwise_refresh);
     rotation.setRepeatCount(Animation.INFINITE);
   }
  });

return true;

}

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

private Menu optionsMenu;
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   // Inflate the menu; this adds items to the action bar if it is present.
   getSupportMenuInflater().inflate(R.menu.display_all, menu);
   optionsMenu = menu;
   return true;
 }
 @Override
 public boolean onKeyUp(int keyCode, KeyEvent event) { 
   if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
     if (event.getAction() == KeyEvent.ACTION_UP &&
         keyCode == KeyEvent.KEYCODE_MENU) {
       //openOptionsMenu();
       optionsMenu.performIdentifierAction(R.id.menu_overflow, 0);
       return true;
     }
   }
   return super.onKeyUp(keyCode, event);
 }

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

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_main, menu);
    final Menu m = menu;
    final MenuItem item = menu.findItem((R.id.action_result_view));
    TextView count = (TextView) menu.findItem(R.id.action_result_view).getActionView();
    count.setText(Integer.toString(mCount));  // so the int isn't mistaken for a resource id!
    count.setOnClickListener(new OnClickListener() {

      @Override
      public void onClick(View v) {
        m.performIdentifierAction(item.getItemId(), 0);
      }
    });
    return true;
  }

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

private Menu mainMenu; // local variable for menu

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  MenuInflater i = getSupportMenuInflater();
  i.inflate(R.menu.main_menu, menu);
  SubMenu subMenu = (SubMenu) menu.findItem(R.id.actionbar_submenu);
  mainMenu = menu; // store the menu in an local variable
  return super.onCreateOptionsMenu(menu);
}

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
  if(event.getAction() == KeyEvent.ACTION_DOWN){
    switch(keyCode) {
    case KeyEvent.KEYCODE_MENU:
      SubMenu subMenu = (SubMenu) mainMenu.findItem(R.id.actionbar_submenu);
      mainMenu.performIdentifierAction(subMenu.getItem().getItemId(), 0);

      return true;  
    }
  }
  return super.onKeyDown(keyCode, event);
}

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

@Override
public boolean onCreateOptionsMenu(Menu menu) {
 getMenuInflater().inflate(R.menu.menu_product_detail, menu);
 final Menu mMenu = menu;
 final MenuItem item = menu.findItem(R.id.action_custom_button);
 item.getActionView().setOnClickListener(new View.OnClickListener(){

  @Override
  public void onClick(View v) {
   mMenu.performIdentifierAction(item.getItemId(), 0);
  }
  });
    return true;
}

代码示例来源:origin: tyrex-team/senslogs

@Override
public void onCreateOptionsMenu(final Menu menu, MenuInflater inflater) {
  getActivity().getMenuInflater().inflate(R.menu.main, menu);
  mActionLogMenuItem = menu.findItem(R.id.action_logs);
  mActionLogMenuItem.getActionView().setOnClickListener(v ->
      menu.performIdentifierAction(mActionLogMenuItem.getItemId(), 0));
  mActionLogMenuItem.setVisible(mLogManager.getLogs().size() != 0);
}

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

private void clickOnMenuItem(int menuItemId, Instrumentation instruments, Menu menuInstance) {
final Integer itemId = menuItemId;
final Menu menu = menuInstance;
instruments.runOnMainSync(new Runnable() {
  @Override
  public void run() {
    menu.performIdentifierAction(itemId, 0);
  }
});

代码示例来源:origin: erikcaffrey/RecyclerView-Examples

@Override protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  ButterKnife.bind(this);
  setupViews();
  drawerPresenter = new DrawerPresenterImpl(this);
  navigationView.getMenu().performIdentifierAction(R.id.nav_linear_v, 0);
}

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

@Override
  public void run() {
    MyLog.v(this, method + "-Log before click");
    clicked = menu.performIdentifierAction(menuItemResourceId, 0);
  }
}

代码示例来源:origin: thuetz/Energize

navigationView.getMenu().performIdentifierAction(R.id.nav_battery_graph, 0);
} else if ("com.halcyonwaves.apps.energize.fragments.TemperatureGraphFragment".equals(getIntent().getAction())) {
  navigationView.getMenu().performIdentifierAction(R.id.nav_temperature_graph, 0);
} else {
  navigationView.getMenu().performIdentifierAction(R.id.nav_overview, 0);

代码示例来源:origin: filestack/filestack-android

nav.getMenu().performIdentifierAction(Util.getSourceIntId(selectedSource), 0);
if (drawer != null) {
  drawer.openDrawer(Gravity.START);

相关文章