zoukankan      html  css  js  c++  java
  • android开发全屏切换代码,记录一下

    private void tryFullScreen(boolean fullScreen) {
      if (activity instanceof AppCompatActivity) {
        ActionBar supportActionBar = ((AppCompatActivity) activity).getSupportActionBar();
        if (supportActionBar != null) {
          if (fullScreen) {
            supportActionBar.hide();
          } else {
            supportActionBar.show();
          }
        }
      }
      setFullScreen(fullScreen);
    }

    private void setFullScreen(boolean fullScreen) {
      if (activity != null) {
        WindowManager.LayoutParams attrs = activity.getWindow().getAttributes();
        if (fullScreen) {
          attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
          activity.getWindow().setAttributes(attrs);
          activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
        } else {
          attrs.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
          activity.getWindow().setAttributes(attrs);
          activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
        }
      }
    }

  • 相关阅读:
    objectMediator
    vi
    string regex
    ar
    widget class in class
    Makefile 语法分析 第三部分
    在Makefile中的 ".PHONY "是做什么的?
    】openssl移植Android使用及其相关经验分享
    精品Android源码推荐,看了绝不后悔
    Makefile 语法分析 第三部分
  • 原文地址:https://www.cnblogs.com/yongfengnice/p/12900761.html
Copyright © 2011-2022 走看看