i want my bottomsheet to behave like attached image in stages like default,dragged and close.
Asked
Active
Viewed 96 times
-3
-
Please provide enough code so others can better understand or reproduce the problem. – JPocoata Oct 19 '21 at 13:16
1 Answers
0
Here is an example :
public class ExampleFragment extends BottomSheetDialogFragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.fragment_pdf_view, container, false);
//Views
return view;
}
@Override
public void onResume() {
super.onResume();
}
@Override
public int getTheme() {
return R.style.AppBottomSheetDialogTheme;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState);
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
BottomSheetDialog d = (BottomSheetDialog) dialog;
FrameLayout bottomSheet = d.findViewById(R.id.design_bottom_sheet);
BottomSheetBehavior.from(bottomSheet).setState(BottomSheetBehavior.STATE_EXPANDED);
}
});
// Do something with your dialog like setContentView() or whatever
return dialog;
}
}

Shogun Nassar
- 606
- 7
- 16
-
dialog should only drag when click on top image rather on dialog. and can you provide full example. – Chirag Thummar Oct 19 '21 at 13:18