some of contents don’t show in FragmentBottomSheetDialog

The solution for “some of contents don’t show in FragmentBottomSheetDialog” can be found here. The following code will assist you in solving the problem.

public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
public void onGlobalLayout() {
if (Build.VERSION.SDK_INT < 16) { view.getViewTreeObserver().removeGlobalOnLayoutListener(this); } else { view.getViewTreeObserver().removeOnGlobalLayoutListener(this); } BottomSheetDialog dialog = (BottomSheetDialog) getDialog(); FrameLayout bottomSheet = (FrameLayout) dialog.findViewById(; BottomSheetBehavior behavior = BottomSheetBehavior.from(bottomSheet); behavior.setState(BottomSheetBehavior.STATE_EXPANDED); behavior.setPeekHeight(0); // Remove this line to hide a dark background if you manually hide the dialog. } }); }

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

inline scripts encapsulated in