简体   繁体   English

对话框片段的绝对位置

[英]Absolute Positioning of Dialog Fragment

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.. 我试图使用下面的代码来放置myCustom对话框..但是对于边缘点,对话框并没有从边缘情况中裁剪出来。.我基本上是试图在菜单项图标上显示对话框。

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

在此处输入图片说明

The glowing circle is a dialog box ,I want to shift to over the Menu Item How do I implement corner cases?? 发光的圆圈是一个对话框,我想移到菜单项上。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM