WindowManager.LayoutParams 札記

WindowManager.LayoutParams wlp = new WindowManager.LayoutParams(width,
                        height, WindowManager.LayoutParams.TYPE_SYSTEM_ERROR,
                        WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
                                | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
                                | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                                | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
                        PixelFormat.TRANSLUCENT);

//TYPE_SYSTEM_ERROR +FLAG_LAYOUT_IN_SCREEN 搭配能夠浮在狀態欄上面 而且 可以 處理 touch 和 click 事件, TYPE_SYSTEM_OVERLAY , TYPE_SYSTEM_ALERT不可以touch 和 click


WindowManager.LayoutParams wlp = new WindowManager.LayoutParams(width,
                        height, WindowManager.LayoutParams.TYPE_PHONE,
                        WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
                                | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,// 不佔用焦點 防止其餘應用須要獲取焦點的時候沒有反應 PixelFormat.TRANSLUCENT);
//這個不能夠越過狀態欄  可移動可點擊
相關文章
相關標籤/搜索