Skip to content

Instantly share code, notes, and snippets.

@jimbray
Created July 14, 2015 07:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimbray/472046c5c74dfb2b6c4c to your computer and use it in GitHub Desktop.
Save jimbray/472046c5c74dfb2b6c4c to your computer and use it in GitHub Desktop.
DrawerLayout与toolbar 的联动动画(左上角的icon动画)
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer);
drawerToggle = setupDrawerToggle();
mDrawerLayout.setDrawerListener(drawerToggle);
private ActionBarDrawerToggle setupDrawerToggle() {
return new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar,
R.string.app_name, R.string.app_name);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
drawerToggle.onConfigurationChanged(newConfig);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
drawerToggle.syncState();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment