Created
February 19, 2021 10:55
-
-
Save dorianpavetic/d21473b392ba7e750ae02c090e659a18 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
@Override | |
public void onSlide(@NonNull View bottomSheet, float slideOffset) { | |
if(slideOffset > 0) //Sliding happens from 0 (Collapsed) to 1 (Expanded) - if so, calculate margins | |
buttonLayoutParams.topMargin = (int) (((expandedHeight - buttonHeight) - collapsedMargin) * slideOffset + collapsedMargin); | |
else //If not sliding above expanded, set initial margin | |
buttonLayoutParams.topMargin = collapsedMargin; | |
binding.sheetButton.setLayoutParams(buttonLayoutParams); //Set layout params to button (margin from top) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment