Created
April 25, 2016 06:15
-
-
Save shem8/699352da50c20dd0ed3c40fd0796259d to your computer and use it in GitHub Desktop.
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
final View container = findViewById(R.id.container); | |
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) container.getLayoutParams(); | |
final CoordinatorLayout.Behavior<View> behavior = new CoordinatorLayout.Behavior<View>() { | |
@Override | |
public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) { | |
return dependency.getId() == R.id.dismiss; | |
} | |
@Override | |
public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) { | |
child.setX(dependency.getX()); | |
child.setAlpha(dependency.getAlpha()); | |
return true; | |
} | |
}; | |
params.setBehavior(behavior); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment