Friday, 5 June 2015

open the navigation Drawer when you click the home screen icon with the three line icon

you need to explicitly define this action, it is not provided automatically by the nav drawer API. Add the following to your activity:


@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        if(mDrawerLayout.isDrawerOpen(drawerList)) {
            mDrawerLayout.closeDrawer(drawerList);
        }
        else {
            mDrawerLayout.openDrawer(drawerList);
        }
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

No comments:

Post a Comment