android 隐藏状态栏和导航栏

 

定义工具类,隐藏状态栏和虚拟按键导航栏

/*
* 常用工具类
* */
public class Common {

    //隐藏状态栏和导航栏
    public static void hideBar(Activity activity){
        if(Build.VERSION.SDK_INT<16){
            int flag = WindowManager.LayoutParams.FLAG_FULLSCREEN;
            activity.getWindow().setFlags(flag,flag);
        }else{
            int uiFlags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
            activity.getWindow().getDecorView().setSystemUiVisibility(uiFlags);
        }
    }

}

 

android 隐藏状态栏和导航栏

上一篇:北京APP外包开发需要注意的几个问题


下一篇:C++ Programming with TDD之一:GMOCK框架简介