当前位置:操作系统 > 安卓/Android >>

Android开发经验一判断当前屏幕是全屏还是非全屏

public void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
        setContentView(R.layout.main); 
         
         
         
         
        int v = this.getWindow().getAttributes().flags; 
        // 全屏 66816 - 非全屏 65792  
        if(v != 66816){//非全屏  
            this.getWindow().setFlags( 
                    WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                    WindowManager.LayoutParams.FLAG_FULLSCREEN); 
        }else{//取消全屏  
            this.getWindow().clearFlags( 
                    WindowManager.LayoutParams.FLAG_FULLSCREEN); 
        } 
 
    }    
 
摘自 落日小屋
补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,