How to change HomeAsUp indicator in new AppCompat Toolbar?

后端 未结 6 1734
既然无缘
既然无缘 2020-12-28 15:01

I wanna change default ActionBar homeAsUp indicator (drawable) in my AppCompat Toolbar. How to achieve that? Only default arrow shows up.

styles (same for other API\

6条回答
  •  有刺的猬
    2020-12-28 15:40

    If android.support.v7.app.ActionBarDrawerToggle used together with DrawerLayout and Toolbar you can change homeAsUp icon with the following code:

    //set home as up indicator
    mDrawerToggle.setHomeAsUpIndicator(R.drawable.ic_up_indicator);
    
    //remove home as up indicator
    mDrawerToggle.setHomeAsUpIndicator(null);
    

    to show homeAsUpIndicator indicator instead of home indicator do following:

    mDrawerToggle.setDrawerIndicatorEnabled(false);
    

    Docs:

    ActionBarDrawerToggle#setHomeAsUpIndicator ActionBarDrawerToggle#setDrawerIndicatorEnabled

提交回复
热议问题