24

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?

dialogAtBottom

kenlukas
  • 3,616
  • 9
  • 25
  • 36
Mithun Kumar
  • 595
  • 1
  • 9
  • 18

3 Answers3

83

Try this

BottomSheetDialog dialog = new BottomSheetDialog(YourActivity.this);
dialog.setContentView(YourView);

dialog.show();
HTMHell
  • 5,761
  • 5
  • 37
  • 79
ak sacha
  • 2,149
  • 14
  • 19
3

Edit: I didn't there was a built in component in Android to do so. Good to know! Also, check this out:

https://medium.com/glucosio-project/moving-from-dialogs-to-bottomsheetdialogs-on-android-15fb8d140295#

I would recommend FragmentDialog without a doubt.

It's so much easier to create a customized Dialog regarding location & layout design.

JonZarate
  • 841
  • 6
  • 28
0

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()
Hamed Jaliliani
  • 2,789
  • 24
  • 31