Which component do I choose to achieve custom dialog at the bottom as shown in the below image? Shall I choose alertdialog
,popupwindow
, or fragmentdialog
?
How to achieve custom dialog at the bottom of the screen in Android
you can use popup window & give in animation for bottom to show –
Exhibitor
Use BottomSheetDialog with custom layout. –
Vilayet
mayojava.github.io/android/bottom-sheets-android –
Zarathustra
Try this
BottomSheetDialog dialog = new BottomSheetDialog(YourActivity.this);
dialog.setContentView(YourView);
dialog.show();
For a great tutorial see: medium.com/glucosio-project/… –
Ox
@ak sacha GREAT straightforward answer. –
Authoritative
Edit: I didn't there was a built in component in Android to do so. Good to know! Also, check this out:
I would recommend FragmentDialog
without a doubt.
It's so much easier to create a customized Dialog
regarding location & layout design.
Kotlin code for run custom ButtomSheetDialog (run inside Activity)
var CustomSelectProfilePicBottomSheetDialog = BottomSheetDialog(this)
val layoutButtomSheetView = this.layoutInflater.inflate(R.layout.ly_custom_buttom_sheet_frg_dialog, null)
CustomSelectProfilePicBottomSheetDialog.setContentView(layoutButtomSheetView)
CustomSelectProfilePicBottomSheetDialog.show()
© 2022 - 2024 — McMap. All rights reserved.