1

I am working on an android app that I currently have and I am trying modifying my app to target Android 5 Lollipop and the new material design.

In the app it has a navigation drawer slide out which is still working fine, however, when the drawer is opened and closed.

I believe, like the Play Store app does, when the navigation drawer is open the hamburger icon is animated into a back arrow, and when closed there is animation from the back arrow back to the hamburger icon.

This part isn't working for my app though and I've been unable to find anything on Google about how to implement this change.

Below is how my ActionBarDrawerToggle is implemented

ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(
                activity, 
                drawerLayout, 
                R.drawable.ic_drawer, 
                drawerOpen, 
                drawerClosed)
        {
            public void onDrawerClosed(View view)
            {
                super.onDrawerClosed(view);
                activity.invalidateOptionsMenu();
                syncState();
            }

            public void onDrawerOpened(View drawerView)
            {
                super.onDrawerOpened(drawerView);
                activity.invalidateOptionsMenu();
                syncState();
            }
        };

        return actionBarDrawerToggle;

Below is how the code above is called and how the toggle is set the navigation drawer

NavigationManager navManager = new NavigationManager(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_closed);
        navManager.prepareActionBar();
        mDrawerToggle = navManager.setDrawerToggle();

        mDrawerLayout.setDrawerListener(mDrawerToggle);

Below is the code for my prepareActionBar function

public void prepareActionBar()
    {
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB)
        {
            activity.getActionBar().setDisplayHomeAsUpEnabled(true);
            activity.getActionBar().setHomeButtonEnabled(true);
        }
    }
halfer
  • 19,824
  • 17
  • 99
  • 186
Boardy
  • 35,417
  • 104
  • 256
  • 447
  • in the play store, the icon isn't animated into a back icon. the back icon (aka, the "up" icon) is only shown when a new view is placed on top (i.e., when you click on a certain app). The function of this "burger" icon is to slightly animate outside of the screen when the side menu is opened. Is this working for you? – Gil Moshayof Oct 19 '14 at 14:55
  • At the moment there is no animation or change in the icon. On my play store version if you slowly slide out the nav drawer you can see the 3 lines from the burger icon rotate round into the left arrow, and then as it is closed the 3 lines from the arrow rotate back to the burger – Boardy Oct 19 '14 at 14:57

0 Answers0