LDrawer

介绍:

material design动画效果的Android drawer 指示图标

运行效果:

使用说明:

主题设置和appcompat_v7 version 21基本一致

<style name="AppTheme" parent="Theme.AppCompat.Light">
    <item name="actionBarStyle">@style/ActionBar</item>
</style>
<style name="ActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="drawerArrowStyle">@style/AppTheme.DrawerArrowToggle</item>
</style>
<style name="AppTheme.DrawerArrowToggle" parent="Base.Widget.AppCompat.DrawerArrowToggle">
    <item name="color">@android:color/white</item>
</style>

先创建drawerArrow

drawerArrow = new DrawerArrowDrawable(this) {
        @Override
        public boolean isLayoutRtl() {
            return false;
        }
    };

然后创建DrawerLayout的监听者,不过这里的ActionBarDrawerToggle并不是android.support.v4.app.ActionBarDrawerToggle,而是com.ikimuhendis.ldrawer.ActionBarDrawerToggle

mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
        drawerArrow, R.string.drawer_open,
        R.string.drawer_close) {
        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
            invalidateOptionsMenu();
        }
        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            invalidateOptionsMenu();
        }
    };
已下载
0