Android弹出窗口浮动在父视图之外

3

我希望隐藏弹出窗口而不是关闭它,将其定位到位置-width,-height。当我尝试将弹出窗口移动到屏幕外时,它会停在父视图的边界处。如何将其移动到屏幕外或半屏幕外?

   View view = LayoutInflater.from(getBaseContext()).inflate(R.layout.mylayout,null);
    pop = new PopupWindow(this);
    pop.setTouchable(false);
    pop.setHeight(200);
    pop.setWidth(200);
    pop.setContentView(view);
    pop.showAtLocation(myparentview, 0, 50, 50);    
    pop.update(-200,-200,-1,-1);

问题概述:无法通过0,0点 无法通过0,0点

这段代码在我的Android ICS上完美运行,尝试更改锚视图并使用此方法:public void update(View anchor,int xoff,int yoff,int width,int height) - Dmytro Danylyk
2个回答

12

0

我不确定但亲爱的可以试试。

根据您使用的设备应用弹出窗口的宽度和高度。 就像这里您应用200*200。 只需在运行时应用此高度和宽度即可。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接