requestFeature must be called before adding content
问题描述
记录一次requestFeature引发的异常
我在调用hideTitleBar相关代码的时候, 调用了api requestFeature ,查了下资料必须要在setContentView之前, 但是我也是在之前的
然后查阅源码, 追溯到ComponentActivity, 是不是’androidx.appcompat:appcompat:1.4.1’太老了, 然后改为1.6.1果然好了
解决方案
升版本
dependencies {
//
...
api 'androidx.appcompat:appcompat:1.6.1'
bingo!