Navigation Drawer icon not showing (Sherlock actionbar)

前端 未结 11 2001
一向
一向 2021-02-04 03:41

Have the navigation Drawer working with the sherlock actionbar but i am having trouble getting the 3 line icon (like gmail) to show instead of the normal up button \"<\". He

11条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-04 04:05

    Though I'm guessing by now you must have worked it out, just wanted to submit an answer:

    Change your code to the following:

    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawer,
            R.drawable.ic_drawer, R.string.menu_open, R.string.menu_close) {
        public void onDrawerClosed(View view) {
    
            super.onDrawerClosed(view);
        }
    
        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
        }
    };
    mDrawerLayout.setDrawerListener(mDrawerToggle);
    getSupportActionBar().setIcon(R.drawable.myIcon);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowTitleEnabled(true);
    

    Essentially, the ActionBar options that you are setting in code need to be set after the DrawerToggle has been completed, not before.

提交回复
热议问题