Android报错之This Activity already has an action bar supplied by the window decor 2.0

Android报错之This Activity already has an action bar supplied by the window decor 2.0

  • 一、报错
  • 二、解决方法
    • 1.修改themes.xml,添加style代码
    • 2.修改Androidmanifest.xml,在相应的Activity里加入android:theme="@style/Theme.TYLDApp.NoActionBar"

一、报错

Android报错之This Activity already has an action bar supplied by the window decor 2.0_第1张图片
java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.

二、解决方法

1.修改themes.xml,添加style代码

Android报错之This Activity already has an action bar supplied by the window decor 2.0_第2张图片

   <style name="Theme.TYLDApp.NoActionBar">
        "windowActionBar">false
        "windowNoTitle">true
    style>

2.修改Androidmanifest.xml,在相应的Activity里加入android:theme=“@style/Theme.TYLDApp.NoActionBar”

Android报错之This Activity already has an action bar supplied by the window decor 2.0_第3张图片

 android:theme="@style/Theme.TYLDApp.NoActionBar"

完美解决!!!

你可能感兴趣的:(android,android,studio,ide)