Android用代码实现全屏

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

    public void toggleFullscreen(boolean fullScreen)  
     {  
      //fullScreen为true时全屏,否则相反  
        
         WindowManager.LayoutParams attrs = getWindow().getAttributes();  
           
         if (fullScreen)  
         {  
             attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;  
         }  
         else  
         {  
             attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;  
         }  
           
         getWindow().setAttributes(attrs);  
     }