I have a bottomsheet behavior in a linear layout. I need to set the peak height of the bottom sheet to below this button, so it works great on all screens instead of giving a constant value.
The bottom sheet is inside a CoordinatorLayout that has that weird transparent big space. I want the sheet to fill up that space
The rounded bottom sheet's peak height should match up to below the Fireworks text

I have tried with setPeekHeight(ContainerOfBottomSheet.getMeasuredHeight()); but it seems to return 0 or an extremely big value.
How can I do that?
UPDATE
This is my code:
private void SettingSheet(LinearLayout sheet, final CoordinatorLayout c) {
final BottomSheetBehavior beh = BottomSheetBehavior.from(sheet);
c.measure(ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.WRAP_CONTENT);
CHeight = c.getMeasuredHeight();
beh.setPeekHeight(CHeight);
}
//This is making the big value I have talked about.