Android中设置全屏的有效方法

来源:互联网 发布:淘宝蜗牛移动充值卡 编辑:程序博客网 时间:2024/06/05 03:14

转载请注明地址:http://blog.csdn.net/v2810769/article/details/52910393

在eclipse里可以使用以下方法

requestWindowFeature(Window.FEATURE_NO_TITLE);          //隐藏状态栏          //定义全屏参数          int flag= WindowManager.LayoutParams.FLAG_FULLSCREEN;          //获得当前窗体对象          Window window= MainActivity.this.getWindow();          //设置当前窗体为全屏显示          window.setFlags(flag, flag);          getWindow().getDecorView().setSystemUiVisibility(View.INVISIBLE);

requestWindowFeature(Window.FEATURE_NO_TITLE);

在android studio中会报错–>>requestFeature() must be called before adding content

在android studio里可以使用以下方法

 //隐藏状态栏        getSupportActionBar().hide();        //定义全屏参数        int flag= WindowManager.LayoutParams.FLAG_FULLSCREEN;        //获得当前窗体对象        Window window= MainActivity.this.getWindow();        //设置当前窗体为全屏显示        window.setFlags(flag, flag);        getWindow().getDecorView().setSystemUiVisibility(View.INVISIBLE);

感谢观看。

0 0
原创粉丝点击