-
-
Save mistrydarshan99/7c1aa99a8d94f2692008 to your computer and use it in GitHub Desktop.
move with drawar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drawerLayout.setDrawerListener(new DrawerLayout.DrawerListener() { | |
@Override | |
public void onDrawerSlide(View drawerView, float slideOffset) { | |
float moveFactor = (drawerView.getWidth() * slideOffset); | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) | |
{ | |
flContent.setTranslationX(-moveFactor); | |
} | |
else | |
{ | |
TranslateAnimation anim = new TranslateAnimation(lastTranslate, -moveFactor, 0.0f, 0.0f); | |
anim.setDuration(0); | |
anim.setFillAfter(true); | |
flContent.startAnimation(anim); | |
lastTranslate = moveFactor; | |
} | |
} | |
@Override | |
public void onDrawerOpened(View drawerView) { | |
} | |
@Override | |
public void onDrawerClosed(View drawerView) { | |
} | |
@Override | |
public void onDrawerStateChanged(int newState) { | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment