// init the bottom sheet behavior
BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(mBottomSheet);
// change the state of the bottom sheet
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
// set callback for changes
bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
// Called every time when the bottom sheet changes its state.
}
@Override
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
if (isAdded()) {
animateBottomSheetArrows(slideOffset);
}
}
});
}
private void animateBottomSheetArrows(float slideOffset) {
// Animate counter-clockwise
mLeftArrow.setRotation(slideOffset * -180);
// Animate clockwise
mRightArrow.setRotation(slideOffset * 180);
}
1 回答
是的,您可以在底部工作表中添加动画 . H