ActionBar Sherlock Menu Item OnClick

前端 未结 4 1557
臣服心动
臣服心动 2021-02-04 03:16

I am new to using the Sherlock ActionBar and I have make it run in my app and I have a item in the actionbar to but I don\'t know how to make the item do something when it\'s cl

4条回答
  •  伪装坚强ぢ
    2021-02-04 03:51

    You use this one
    

    public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
          getSherlockActivity().getSupportMenuInflater().inflate(R.menu.settingmenu, menu);
        getSherlockActivity().getSupportMenuInflater().inflate(R.menu.menugridcalendar,me
    }
    

    This will be added in your sherlockfragment activity:
    
    
    public boolean onOptionsItemSelected(MenuItem item) {
          switch (item.getItemId()) {
          case R.id.settings:
              Intent intent=new Intent(currentclass.this, calledclass.class);
              startActivity(intent);
              return true;
          }
          return false;
    }
    

提交回复
热议问题