BottomSheetDialogFragment - How to set expanded height (or min top offset)

后端 未结 5 1686
执笔经年
执笔经年 2020-12-12 18:13

I create a BottomSheetDialogFragment and I want to adjust it\'s maximum expanded height. How can I do that? I can retrieve the BottomSheetBehaviour

5条回答
  •  借酒劲吻你
    2020-12-12 18:44

    I found a much simpler answer; in your example where you obtain the FrameLayout for the bottom sheet using this code

    View bottomSheet = dialog.findViewById(R.id.design_bottom_sheet);
    

    you can then set the height on the layout params for that View to whatever height you want to set the expanded height to.

    bottomSheet.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
    

提交回复
热议问题