Your code shown here is so limited that I can't also present code that is directly applicable to your case. At least I would suggest there is BottomSheetBehavior#setState(BottomSheetBehavior.STATE_EXPANDED)
method.
Here is a minimum sample code:
MainActivity:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
BottomSheetDialog dialog = new BottomSheetDialog(this);
BottomSheetBehavior<FrameLayout> behavior = dialog.getBehavior();
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
View bottomSheet = getLayoutInflater().inflate(R.layout.bottom_sheet, null);
dialog.setContentView(bottomSheet);
dialog.show();
}
}
layout/bottom_sheet:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="a\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na"
android:textSize="30sp" />
</ScrollView>
EDIT:
You can manage to expand the BottomSheet's content layout beyond its content originally requiring though I doubt you need to use BottomSheet for such usage...
MyBottomSheetDialog:
public class MyBottomSheetDialog extends BottomSheetDialog {
public MyBottomSheetDialog(@NonNull Context context) {
super(context);
DisplayMetrics displayMetrics = new DisplayMetrics();
((Activity) context).getWindowManager()
.getDefaultDisplay()
.getMetrics(displayMetrics);
BottomSheetBehavior<FrameLayout> behavior = getBehavior();
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
View bottomSheet = getLayoutInflater().inflate(R.layout.bottom_sheet, null);
bottomSheet.setLayoutParams(new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, displayMetrics.heightPixels
));
setContentView(bottomSheet);
}
}
layout/bottom_sheet:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="a\na"
android:textSize="30sp" />
</FrameLayout>