我尝试了下面提到的代码来设置底部工作表的 peekheight,但我需要将内容高度设置为底部工作表而不是父高度或固定高度。
View view = getView();
view.post(() -> {
View parent = (View) view.getParent();
CoordinatorLayout.LayoutParams params =
(CoordinatorLayout.LayoutParams) (parent).getLayoutParams();
CoordinatorLayout.Behavior behavior = params.getBehavior();
bottomSheetBehavior = (BottomSheetBehavior) behavior;
bottomSheetBehavior.setPeekHeight(430);
//bottomSheetBehavior.setPeekHeight(view.getMeasuredHeight());
bottomSheetBehavior.setDraggable(true);
((View) bottomSheet.getParent()).setBackgroundColor(Color.TRANSPARENT);
});