java.lang.IllegalStateException: This Activity already has an action bar supplied by the window deco
来源:互联网 发布:伟星ppr水管颜色 知乎 编辑:程序博客网 时间:2024/05/17 21:55
在项目中使用了toolbar,并在activity里面设置了:setSupportActionBar(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.
分析:
这里是因为AndroidManifest.xml的application节点中引用了 @style/AppTheme样式,这个样式自带actionbar
解决方法:
在styles.xml中自定义一个style:
<!-- 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> //自定义的 <style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:windowActionBar">false</item> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style>
阅读全文
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_
- 基础、柱标高
- XXE攻击指南
- 如何在 XAMPP 中设置多个网站
- IIPP Week 2
- PhotoShop CS5 EXTENED(12.0 x64)快捷键汇总
- java.lang.IllegalStateException: This Activity already has an action bar supplied by the window deco
- Custom Animation——自定义动画
- 以浏览器打开网页为例分析计算机内部一系列操作动作
- Ubuntu打开终端的三种方法
- Android ImageSlider广告轮播框架
- 柱底标高
- Sql server 双机热备份数据库
- Beebird的小e体验板学习历程1
- 基于jsp+servlet+javabean开发的登录模块