Absolute Positioning of Dialog Fragment

235 views Asked by At

I am trying to position myCustom Dialog using the below piece of code.. but somehow for the edge points the dialog is not cropping from the edges cases..I am basically trying to show dialog over a menu Item icon..

    Window window = getDialog().getWindow();
    WindowManager.LayoutParams params = window.getAttributes();
    window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    params.x = (int) x;
    params.y = (int) y;
    window.setAttributes(params);

enter image description here

The glowing circle is a dialog box ,I want to shift to over the Menu Item How do I implement corner cases??

1

There are 1 answers

0
AndroidEnthusiast On

What you want in that case is a full screen dialog, you have to add the following flags when creating the dialog:

window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                        WindowManager.LayoutParams.FLAG_FULLSCREEN);