我的应用使用:
WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
我通过代码将视图添加到windowManager:
MyContextWrapper myContextWrapper= new MyContextWrapper(this);
// I created customview in myContextWrapper
View view = myContextWrapper.getView();
int FLAG = WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
| WindowManager.LayoutParams.FLAG_FULLSCREEN
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD;
int type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
WindowManager.LayoutParams params = new WindowManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, type,
FLAG, PixelFormat.UNKNOWN);
mWindowManager.addView(view, params);
删除视图后,如何清除视图内存?我想清除它,因为在新的MyContextWrapper(this)getview之后内存增加并添加到mWindowManager。
mWindowManager.removeView(view);
myContextWrapper.getView()include(ImageView,ViewPager ...)