zoukankan      html  css  js  c++  java
  • android.util.AndroidRuntimeException: requestFeature() must be called before adding content 错误解决方法

    Activity全屏,网上的代码如下:
    protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//去掉信息栏
        setContentView(R.layout.activity_main);
    }

    但在AS中,会提示错误:
    android.util.AndroidRuntimeException: requestFeature() must be called before adding content
    解决如下:
    protected void onCreate(Bundle savedInstanceState) {
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//去掉信息栏
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    }
  • 相关阅读:
    tree
    mkdir
    touch
    rename
    dirname
    vue之导入Bootstrap以及jQuery的两种方式
    Vue组件系统
    报错:ERROR! The server quit without updating PID file (/usr/local/var/mysql/chenyuntekiMacBook-Air.local.pid).
    Linux命令
    Vue知识点小总结1
  • 原文地址:https://www.cnblogs.com/daniel-zhang/p/5145555.html
Copyright © 2011-2022 走看看