带动画的Android抽屉图标:LDrawer
jopen
10年前
Android 抽屉图标拥有 material 设计动画。
drawerArrow = new DrawerArrowDrawable(this) { @Override public boolean isLayoutRtl() { return false; } };
Then create 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(); } };
You can stop or start animation
mDrawerToggle.setAnimateEnabled(false);
You can set drawerArrow
progress or change color
drawerArrow.setProgress(0f); // normal position drawerArrow.setProgress(1f); // back arrow position drawerArrow.setColor(R.color.ldrawer_color); // to set color