android popupwindow浮动在父视图之外
我不想关闭弹出窗口,而是想将其隐藏在屏幕外的位置-宽度-高度。当我尝试更新屏幕外的弹出窗口时,它会在父视图的边界处停止。如何在屏幕外或半屏幕外更新android popupwindow浮动在父视图之外,android,Android,我不想关闭弹出窗口,而是想将其隐藏在屏幕外的位置-宽度-高度。当我尝试更新屏幕外的弹出窗口时,它会在父视图的边界处停止。如何在屏幕外或半屏幕外更新 View view = LayoutInflater.from(getBaseContext()).inflate(R.layout.mylayout,null); pop = new PopupWindow(this); pop.setTouchable(false); pop.setHeight(200);
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);
问题快照:
我不确定,但是亲爱的,试试这个 根据您使用的设备应用popwindow的宽度和高度。 就像你在这里申请的那样200*200。
只需在运行时应用此高度和宽度。我认为您缺少的是将
setClippingEnabled
与false
一起使用
您应该在调用
update()
之前调用它,这样可以在屏幕边界外绘制窗口。这段代码在Android IC上非常适合我,请尝试更改锚定视图并使用此方法:public void update(视图锚定、int xoff、int yoff、int width、int height)