设置全屏出来的onCreate [英] Set Full Screen out onCreate

查看:140
本文介绍了设置全屏出来的onCreate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只能把我的活动,以全屏的onCreate方法(之前的setContentView)?

I can only set my Activity to Full Screen in onCreate method (before setContentView)?

有什么办法,我可以设置为全屏的onCreate之外?

Is there any way I can set to full screen outside of onCreate?

感谢

推荐答案

是可能的!添加此code。

Is possible! Adding this code.



    // go full screen
    WindowManager.LayoutParams attrs = mActivity.getWindow().getAttributes();
    attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
    mActivity.getWindow().setAttributes(attrs);

    // go non-full screen
    WindowManager.LayoutParams attrs = mActivity.getWindow().getAttributes();
    attrs.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
    mActivity.getWindow().setAttributes(attrs);

这篇关于设置全屏出来的onCreate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆