Navigation Drawer ActionBar button not working

后端 未结 4 995
盖世英雄少女心
盖世英雄少女心 2020-12-07 20:48

I am working on an android project and I\'m trying to integrate the new Navigation Drawer using the example from http://developer.android.com/training/implementing-navigatio

4条回答
  •  借酒劲吻你
    2020-12-07 20:57

    You forgot to implement onOptionsItemSelected

    This is where the magic happens:

    @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            // Pass the event to ActionBarDrawerToggle, if it returns
            // true, then it has handled the app icon touch event
            if (mDrawerToggle.onOptionsItemSelected(item)) {
              return true;
            }
            // Handle your other action bar items...
    
            return super.onOptionsItemSelected(item);
        }
    

提交回复
热议问题