在拖下底片后,它会将自己隐藏在屏幕上(因为app:behavior_hideable =" true"),你如何取回它?
拖拽不起作用。我不得不离开活动,然后回来让底片回来。
<br>
答案 0 :(得分:0)
使用底部回调来检测状态变化。
BottomSheetBehavior mBehavior;
protected BottomSheetBehavior.BottomSheetCallback mBottomSheetBehaviorCallback = new BottomSheetBehavior.BottomSheetCallback() {
@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
if (newState == BottomSheetBehavior.STATE_HIDDEN) {
mBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
}
}
@Override
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
}
};
mBehavior.setBottomSheetCallback(mBottomSheetBehaviorCallback);
使用show()显示底部工作表
private void showBottomSheet(){
if(!bottomSheet.isVisible()){
bottomsheet.show(((AppCompatActivity) getContext()).getSupportFragmentManager(), bottomsheet.getTag());
}
}