Up arrow does not show after calling ActionBarDrawerToggle.setDrawerIndicatorEnabled(false)

后端 未结 4 1704
北荒
北荒 2020-12-31 05:01

The title says it all. When I call the mDrawerToggle.setDrawerIndicatorEnabled(false) I don\'t want the \"hamburger\" icon to be shown anymore but

4条回答
  •  Happy的楠姐
    2020-12-31 05:43

    This one stumped me for a while, as I knew there was a default up icon being used (from looking at the source of ActionBarDrawerToggle), and I wanted it to adopt the color set for R.attr.colorControlNormal. Amazingly, the order of these two lines is crucial for actually showing the up arrow:

    mDrawerToggle.setDrawerIndicatorEnabled(false);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    

    setDrawerIndicatorEnabled must be called on your ActionBarDrawerToggle before setDisplayHomeAsUpEnabled is called on your ActionBar. Both lines must be called for the default (tinted) arrow to show.

提交回复
热议问题