[英]Hiding/showing a fragment that's inside a bottom-sheet sets the bottom-sheet's state to expanded
当状态更改为折叠时,我正在尝试隐藏底部工作表中的片段。
问题在于,当它隐藏时,底页会展开。
如何在不展开底部工作表的情况下使其消失?
behavior.addBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
if(newState==BottomSheetBehavior.STATE_COLLAPSED){
if(fragmentTransaction!=null)
{
fragmentTransaction=fragmentManager.beginTransaction();
fragmentTransaction.hide(fragment).commit();
}
}
}
检查下面
if(newState==BottomSheetBehavior.STATE_EXPANDED){
behavior.setHideable = true
behavior.setState(BottomSheetBehavior.STATE_COLLAPSED)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.