How to achieve custom dialog at the bottom of the screen in Android How to achieve custom dialog at the bottom of the screen in Android android android

How to achieve custom dialog at the bottom of the screen in Android


Try this

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


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.


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()