AndroidRuntimeException: requestFeature() must be called before adding content

requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
增加代码requestWindowFeature(Window.FEATURE_NO_TITLE)以去掉标题栏,并且代码放在 setContentView之前,但还是报异常
android.util. AndroidRuntimeException: requestFeature() must be called before adding content
AppCompatActivity改为Activity才得以解决。不知道AppCompatActivity和Activity有何区别。

参考: http://www.cnblogs.com/and_he/archive/2011/06/01/2067106.html Android中全屏或者取消标题栏

你可能感兴趣的:(AndroidRuntimeException: requestFeature() must be called before adding content)