When I'm sliding the persistent bottom sheet inside my app, I want to know the current height of the bottom sheet at that moment. I tried with calling BottomSheetCallback's onSlide method but it didn't work.
bottomSheetView = findViewById(R.id.bottom_sheet);
bottomSheetBehavior = BottomSheetBehavior.from(bottomSheetView);
bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
if(BottomSheetBehavior.STATE_DRAGGING == newState)
Log.i("MainActivity", "onStateChanged >> " + bottomSheet.getHeight());
}
@Override
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
Log.i("MainActivity", "onSlide bottomSheet>> " + bottomSheet.getHeight());
Log.i("MainActivity", "onSlide bottomSheetView>> " + bottomSheetView.getHeight());
}
});