Created
July 7, 2020 15:39
-
-
Save MrCrambo/ba6943bd18f1008032985282bcdf4eb9 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
LinearLayout bottomSheet = findViewById(R.id.bottom_sheet_behavior_id); | |
BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet); | |
// .. | |
// here you could find all the UI views inside your bottom sheet and initialize them | |
// .. | |
// .. | |
// setting the bottom sheet callback for interacting with state changes and sliding | |
bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { | |
@Override | |
public void onStateChanged(View view, int i) { | |
// do something when state changes | |
} | |
@Override | |
public void onSlide(View view, float v) { | |
// do something when slide happens | |
} | |
}); | |
// .. | |
// set the bottom sheet callback state to hidden when you just start your app | |
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment