我使用 TYPE_APPLICATION_OVERLAY 创建了多个浮动窗口,如下所示
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
width,
height,
x,
y,
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_SECURE |
WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES |
WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING |
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM |
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
, PixelFormat.TRANSLUCENT);
params.gravity = gravity;
(WindowManager) (hostApp.getSystemService(Context.WINDOW_SERVICE)).addView(view, params);
2 浮动窗口按 W1、W2 的顺序创建。W2 显示在 W1 之上。我想把 W1 窗口放在前面。
寻找类似的东西
view.bringToFront();
用于叠加。