3
我看到我可以在鎖屏上顯示。但我希望它可以選擇。目前我使用這些PARAMS來實現這一目標:如何以編程方式更改WindowManager.LayoutParams的類型?
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_SYSTEM_ERROR,
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH |
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, PixelFormat.TRANSPARENT);
而且,不顯示在鎖定屏幕上它,我用
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH |
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, PixelFormat.TRANSPARENT);
另外他們的工作很好,但我想改變的類型和標誌編程。所以,我想用
params.flags &= ~WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
params.flags &= ~WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
params.flags |= WindowManager.LayoutParams.TYPE_PHONE;
windowManager.updateViewLayout(myView,params);
改變WindowManager.LayoutParams去除類型,刪除標誌,並設置一個新的類型, 但似乎並沒有工作。有誰知道如何正確地做到這一點?
我怎麼錯過'type'屬性?謝謝! – Denny