I'm using setDisplayHomeAsUpEnabled in order to show the arrow instead of the drawer "burger" icon but it's not getting animated or anything. Instead it shows the arrow drawable instantaneously.
Home screen: (Album 1)
When you tap a movie: (Album 2)
The thing is, the icon does the animation just fine when I slide the drawer, which makes me think that maybe I'm not supposed to use setDisplayHomeAsUpEnabled for this: (Album 3)
Album: http://imgur.com/a/LkXbh
Here's my drawer toggle code:
Toolbar toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar);
setSupportActionBar(toolbar);
drawerAdapter = new DrawerAdapter(this, App.getNavItems(), getSupportFragmentManager());
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
drawerList = (ExpandableListView) findViewById(R.id.left_drawer);
// Set onGroupClick and onChildClick
drawerAdapter.setClickEvents(MainActivity.this, drawerLayout, drawerList);
drawerList.setAdapter(drawerAdapter);
ActionBarDrawerToggle toolbarDrawerToggle = new ActionBarDrawerToggle(
this,
drawerLayout,
toolbar,
R.string.drawer_open,
R.string.drawer_close
) {
public void onDrawerClosed(View view) {
super.onDrawerClosed(view);
invalidateOptionsMenu();
}
public void onDrawerOpened(View view) {
super.onDrawerOpened(view);
invalidateOptionsMenu();
}
};
drawerLayout.setDrawerListener(toolbarDrawerToggle);
toolbarDrawerToggle.syncState();
EDIT: I want the animation not when opening the drawer, that works already.
I would like to manually trigger the animation when I load a specific fragment. I may not have explained myself correctly.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…