Reputation: 1106
I implemented navigation drawer as described here in android developer portal. And everything works fine. Now I read android guidlines here. In section "Introduce the user to the drawer at first use" there is described I should open the drawer when application launches first. Now my idea for implementing this is to open the drawer after opening the app (and maybe close it again).
Now I tried to call myDrawer.openDrawer(Gravity.LEFT) in onCreate and the drawer is open when the app launches, but there's no animation. So onCreate seems to be the wrong place. Where should I place the call to openDrawer to let the user see the animation?
Upvotes: 2
Views: 3271
Reputation: 16043
I guess you can do this by delaying the animation. For example:
@Override
protected void onResume() {
super.onResume();
myDrawer.postDelayed(new Runnable() {
@Override
public void run() {
myDrawer.openDrawer(Gravity.LEFT)
}
}, 1000);
}
However the fact that the Android Guidelines suggests the drawer to be opened when the application launches for the first time, does not imply it should be animated.
Upvotes: 12