I've an activity. After setting the Dialog Theme I'm able to make it as a Dialog. I want to make it as a BottomSheetDialog. I want the dialog to be seen as bottom sheet and not a simple dialog.
Is there any way to startActivity directly as a BottomSheet?
Any help will be appreciated.
First convert:
AlertDialog dialog =
new AlertDialog.Builder(getContext()).customView(R.layout.dialog_my_loads_finish, false)
.show();
to:
View view = View.inflate(getActivity(), R.layout.dialog_my_loads_finish, null);
BottomSheetDialog dialog = new BottomSheetDialog(getActivity());
dialog.setContentView(view);
and if you want to set specific height for bottom sheet you have to change R.layout.dialog_my_load_finish
root to CoordinateLayout
and add id and app:layer_behavior to first child
then:
dialog.setOnShowListener(dialog2 -> {
View bottomSheet = dialog.findViewById(R.id.dialog_question_confirm_ct);
BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
bottomSheetBehavior.setPeekHeight(bottomSheet.getHeight());
});
finally: dialog.show()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With