首页 > 代码库 > WindowManager.LayoutParams 札记

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);

//这个不可以越过状态栏 可移动可点击

 

WindowManager.LayoutParams 札记