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);
        }
      }
    }

  • 相关阅读:
    04.sys
    leetcode算法-加油站
    Spring动态AOP
    (java反射-JDK动态代理)+CGLIB动态代理
    java反射-基础语法
    leetcode算法-验证回文串
    leetcode算法-盛最多水的容器
    leetcode算法-两数之和
    leetcode算法-三数之和
    leetcode算法-最长和谐子序列
  • 原文地址:https://www.cnblogs.com/yongfengnice/p/12900761.html
Copyright © 2011-2022 走看看