java.lang.IllegalStateException: This Activity already has an action bar supplied by the window deco
来源:互联网 发布:php require 编辑:程序博客网 时间:2024/05/09 12:18
最近在使用toolbar的过程中遇到了一个error,提示是这样的:
Caused by: 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.
还有一种情况是这样的:
Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
其实这主要还是我用android.support.v7.widget包里面的toolbar导致的,上面也说得很清楚in your theme to use a Toolbar instead.这接下来就非常简单了,我们直接在主题里面设置下就可以了,如下:
<!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style>//自己定义的,把actionBar挂掉就可以了,以及TItle <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style>
tips:
Please mark that, even if api levels higher than 10 already have actionbar you should still use AppCompat styles. If you don’t, you will have this error on launch of Acitvity on devices with android 3.0 and higher:
0 0
- java.lang.IllegalStateException: This Activity already has an action bar supplied by the window deco
- java.lang.IllegalStateException: This Activity already has an action bar supplied by the window deco
- java.lang.IllegalStateException: This Activity already has an action bar supplied by the window deco
- Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the
- Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the
- Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the
- IllegalStateException: This Activity already has an action bar supplied by the window decor.
- Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied b
- This Activity already has an action bar supplied by the window decor
- 解决 This Activity already has an action bar supplied by the window decor 错误
- This Activity already has an action bar supplied by the window decor.
- This Activity already has an action bar supplied by the window decor.
- 错误集锦之一:This Activity already has an action bar supplied by the window decor.
- 错误集锦之一:This Activity already has an action bar supplied by the window decor.
- Android异常:This Activity already has an action bar supplied by the window decor
- This Activity already has an action bar supplied by the window decor
- This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE
- This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_
- Programming with Objective-C(一)
- leetcode——35——Search Insert Position
- 宁静的午后
- 安装配置sonar
- Light OJ 1274 Beating the Dataset (推公式)
- java.lang.IllegalStateException: This Activity already has an action bar supplied by the window deco
- Android写字绘图播放功能实现
- com.android.sdklib.repository.FullRevision
- 电压比较器之LM393工作原理
- 简单在线聊天系统的实现(初步)
- 消息队列设计与实现
- 内部类笔记
- PySpider爬虫框架折腾体验
- HDU 2073