2015-05-09 79 views
1

我吹佈局TYPE_SYSTEM_ALERTFLAG_LAYOUT_IN_SCREEN如何關閉充氣佈局?

params = new WindowManager.LayoutParams(
      WindowManager.LayoutParams.FILL_PARENT, 
      WindowManager.LayoutParams.FILL_PARENT, 
      WindowManager.LayoutParams.TYPE_SYSTEM_ALERT , 
      WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN, 
      Color.YELLOW); 

    wm = (WindowManager) getApplicationContext() 
      .getSystemService(Context.WINDOW_SERVICE); 

    mTopView = (ViewGroup) getLayoutInflater().inflate(R.layout.lock_screen, null); 
    getWindow().setAttributes(params); 
    wm.addView(mTopView, params); 

如何關閉或關閉呢?

回答

3

使用下面的代碼需要

if(mTopView!=null) { 
    wm.removeView(mTopView); 
} 
時,取出你的看法