今天有人问我 This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_

这是个什么错误.首先说一下产生这个错误的原因:

因为当在activity中调用了setSupportActionBar(toolbar); 同时你的AndroidManifest.xml文件中

android:theme="@style/AppTheme"
This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_

并且你的style资源文件中

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_

这时就会报这个异常,那么解决办法有两种:

1.将parent="Theme.AppCompat.Light.DarkActionBar"修改成 parent="Theme.AppCompat.Light.NoActionBar"

2.This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_

相关文章:

  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2021-05-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-15
猜你喜欢
  • 2021-08-06
  • 2022-12-23
  • 2021-03-26
  • 2022-12-23
  • 2021-06-22
  • 2021-08-06
  • 2022-12-23
相关资源
相似解决方案