你好我有这个代码来显示弹出窗口......
final WindowManager.LayoutParams parameters = new WindowManager.LayoutParams(
(width/100)*50, height, WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT);
parameters.gravity = Gravity.CENTER | Gravity.CENTER;
parameters.x = (width/100)*50;
parameters.y = 0;
但我需要在屏幕外显示它... 当我将x位置设置为更大,然后将窗口大小设置在角落时,它不会越过屏幕......
感谢。
编辑:因为有些人不知道我的意思..我的意思是一半外屏幕不满..
答案 0 :(得分:2)
您需要再添加一个flag_layout_no_limits
final WindowManager.LayoutParams parameters = new WindowManager.LayoutParams(
(width/100)*50, height,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT);
parameters.gravity = Gravity.CENTER | Gravity.CENTER;
parameters.x = (width/2);
parameters.y = 0;