Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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

like image 446
Mithun Kumar Avatar asked Feb 18 '17 12:02

Mithun Kumar


People also ask

How do I show custom dialog?

This example demonstrate about how to make custom dialog in android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.

How do I make alert dialog fill 90 of screen size?

You can use percentage for (JUST) windows dialog width. All you need to do is extend this theme and change the values for "Major" and "Minor" to 90% instead 65%. Regards.

What is a dialog window in Android?

A dialog is a small window that prompts the user to make a decision or enter additional information. A dialog does not fill the screen and is normally used for modal events that require users to take an action before they can proceed. Dialog Design.


2 Answers

Try this

BottomSheetDialog dialog = new BottomSheetDialog(YourActivity.this); dialog.setContentView(YourView);  dialog.show(); 
like image 172
ak sacha Avatar answered Nov 09 '22 09:11

ak sacha


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.

like image 22
JonZarate Avatar answered Nov 09 '22 10:11

JonZarate