BottomSheetDialogFragment bottomSheet = new MyBottomSheetDialogFragment(); bottomSheet.show(getChildFragmentManager(), "tag");
View view = inflater.inflate(R.layout.bottom_sheet_layout, container, false); BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(view.findViewById(R.id.bottom_sheet)); ... return view;
public void setBottomSheetBehavior(BottomSheetBehavior bottomSheetBehavior) { this.bottomSheetBehavior = bottomSheetBehavior; }
然后在子Fragment中,使用主要的Fragment或Activity获取底部对话框的BottomSheetBehavior并进行必要的操作。
以上是一些基本的解决方法,但具体情况可能因应用程序的不同而异。在调试过程中,可以尝试使用调试器或添加调试日志来定位问题并找到适合的解决方法。