Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way use new DrawerLayout with ActionBarSharlock?

I am wondering if there any way to use new DrawerLayout from support library with ActionBarSherlock? I found workaround for ICS+ but what i need is support for android 2.2+ The problem is that ABS hold reference for original android.view.MenuItem only when ICS+ but for older version there is inner implementation that not hold reference for original one.

like image 262
Androider Avatar asked May 20 '13 16:05

Androider


2 Answers

If you are looking a way to open and close the DrawerLayout when user touch Icon from ActionBar, you can use this:

switch (item.getItemId()) {
    case android.R.id.home:
        if (mDrawerLayout.isDrawerOpen(mDrawerList)) {
            mDrawerLayout.closeDrawer(mDrawerList);
        } else {
            mDrawerLayout.openDrawer(mDrawerList);
        }
        return true;

    }
    return true;
}
like image 165
Enrique Diaz Avatar answered Nov 10 '22 17:11

Enrique Diaz


There is a project on GitHub that works perfectly

SherlockNavigationDrawer

Hope this helps

like image 41
SeanSWatkins Avatar answered Nov 10 '22 15:11

SeanSWatkins