3 Line Icon Is Not Animating Into A Smaller Image In Navigation Drawer
The small icon(indicator or 3 line) beside the logo, is not changing into a smaller one. --> this image is not animating, When I click the apps' logo the drawer is opened but
Solution 1:
please ensure you put this line into your code where you declared your ActionBarDrawerToggle:
mDrawerLayout.setDrawerListener(mDrawerToggle);
as you can see in this example:
publicclassMyActivityextendsActionBarActivity {
privateDrawerLayout mDrawerLayout;
privateListView mDrawerList;
privateActionBarDrawerToggle mDrawerToggle;
privateString[] menuitems;
@OverrideprotectedvoidonCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerList = (ListView) findViewById(R.id.left_drawer);
menuitems = getResources().getStringArray(R.array.optionsname);
MyDrawerAdapter draweradapter = newMyDrawerAdapter(getApplicationContext(), menuitems);
mDrawerList.setAdapter(draweradapter);
mDrawerToggle = newActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.drawer_open, R.string.drawer_close) {
publicvoidonDrawerClosed(View view) {
invalidateOptionsMenu();
}
publicvoidonDrawerOpened(View drawerView) {
invalidateOptionsMenu();
}
@OverridepublicvoidonDrawerSlide(View drawerView, float slideOffset) {
super.onDrawerSlide(drawerView, slideOffset);
mDrawerLayout.bringToFront();
mDrawerLayout.bringChildToFront(drawerView);
mDrawerLayout.requestLayout();
mDrawerLayout.invalidate();
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
mDrawerList.setOnItemClickListener(newDrawerItemClickListener());
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setIcon(newColorDrawable(0x00000000));
getSupportActionBar().setBackgroundDrawable(newColorDrawable(0xffffffff));
}
}
if you forget to add the drawerlistener to the drawerlayout it wont animate your drawer icon.
Solution 2:
Although I had this problem with SherlockNavigationDrawer, maybe it help someone: ensure you don't forgot to call super in overriden drawer's methods (onDrawerOpened/Closed).
Post a Comment for "3 Line Icon Is Not Animating Into A Smaller Image In Navigation Drawer"