Skip to content

Instantly share code, notes, and snippets.

@vaibhav-jani
Created July 29, 2015 08:42
Show Gist options
  • Select an option

  • Save vaibhav-jani/cc958e6012ea9c422a85 to your computer and use it in GitHub Desktop.

Select an option

Save vaibhav-jani/cc958e6012ea9c422a85 to your computer and use it in GitHub Desktop.
move with drawar
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