Abhinav korpal
Abhinav korpal

Reputation: 21

How can I open the dialog from bottom but it will be show only in between half of the screen from bottom in android

Here is the method I tried for dialog from bottom

   dialog = new Dialog(activity, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.coachingtip_discover);
        ImageView imageclose = (ImageView) dialog.findViewById(R.id.btn_close1);

        TextView textsmg = (TextView) dialog.findViewById(R.id.discover_inspire_text);

        TextView textsmg2 = (TextView) dialog.findViewById(R.id.add_photo_text2);

        TextView textsmg3 = (TextView) dialog.findViewById(R.id.add_photo_text1);

        dialog.show();

Upvotes: 1

Views: 941

Answers (1)

OBX
OBX

Reputation: 6114

This is how you render the Dialog at the bottom :

dialog = new Dialog(activity, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.coachingtip_discover);
Window window = dialog.getWindow();
WindowManager.LayoutParams wlp = window.getAttributes();

wlp.gravity = Gravity.BOTTOM;
wlp.flags &= ~WindowManager.LayoutParams.FLAG_DIM_BEHIND;
window.setAttributes(wlp);

Upvotes: 1

Related Questions