继承了 AppCompatActivity 的 Activity 如何隐藏标题栏呢?
首先我会想到使用
requestWindowFeature(Window.FEATURE_NO_TITLE)
,
不过并没有效果;
然后我在 AndroidManifest.xml 文件中修改主题,用的是
android:theme="@android:style/Theme.NoTitleBar"
,
还是没用,还报错了
You need to use a Theme.AppCompat theme (or descendant) with this activity.(你必须使用Theme.AppCompat主题或者其子类主题)
解决的方案
在 AndroidManifest.xml 文件中修改主题,使用android:theme="@style/Theme.AppCompat.Light.NoActionBar"