android学习——requestFeature() must be called before adding content

1、错误原因:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sqh.progressbar/com.example.sqh.progressbar.MainActivity}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content


2、百度的方法:

经过一番百度,发现答案基本上都是:只需要保证setContentView方法在requestWindowFeature方法之后执行就可以了。

可是我的代码明明已经是这样了哈,搞不懂为什么还会出错,,,

android学习——requestFeature() must be called before adding content_第1张图片


3、最终解决的方法:

试了一下将两句requestWindowFeature放在super.onCreate(savedInstanceState);之前,结果运行起来就不会蹦了,

android学习——requestFeature() must be called before adding content_第2张图片

可是还是达不到目的,标题栏没有出现进度条,,,,

待补充。。。。

你可能感兴趣的:(android学习——requestFeature() must be called before adding content)