zoukankan      html  css  js  c++  java
  • 当 Activity 以全屏模式运行时,如何允许 Android 系统状态栏在顶层出现,而不迫使 Activity 重新布局让出空间?

    参考资料:

    http://www.zhihu.com/question/19760889

    private void hideStatusBar() {
    WindowManager.LayoutParams attrs = getWindow().getAttributes();
    attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
    getWindow().setAttributes(attrs);
    }
    
    private void showStatusBar() {
    WindowManager.LayoutParams attrs = getWindow().getAttributes();
    attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
    getWindow().setAttributes(attrs);
    }
    关键是,在做了该Activity的全屏设置的前提下,还要在onCreate()方法中加入如下语句:
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
  • 相关阅读:
    自己总结的Java归并排序代码
    SpringDataJpa
    多态
    向上转型向下转型
    python面向对象装饰器
    Apache
    git
    μWSGI
    虚拟环境
    软件仓库(持续更新中)
  • 原文地址:https://www.cnblogs.com/8dull/p/5383021.html
Copyright © 2011-2022 走看看