异常信息:

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.

问题原因:

当在activity中调用了setSupportActionBar(toolbar);

同时,AndroidManifest.xml 对应的Activity标签的android:theme为

同时,AndroidManifest.xml 对应的Activity标签的android:theme为

android:theme="@style/AppTheme" >

且,style资源文件中的parent为

parent="Theme.AppCompat.Light.DarkActionBar

就会报这个异常。

问题分析:

Using Theme.AppCompat.Light tells Android that you want the framework to provide an ActionBar for you. However, you are creating your own ActionBar (a Toolbar), so you are giving the framework mixed signals as to where you want the ActionBar to come from.

解决方法:

在style.xml中加入:

在Manifest.xml中,修改theme

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 t的更多相关文章

  1. This Activity already has an action bar supplied by the window decor

    问题描写叙述:继承自AppCompatActivity,使用Toolbar替代ActionBar的时候.出现错误 错误信息: 2.Caused by: java.lang.IllegalStateEx ...

  2. 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. Do not request Window.FEATURE_ ...

  3. Fragment碎片频繁来回切换的时候报java.lang.IllegalStateException: No activity

    出现这个问题的原因是因为使用的transcation.replace(fragmentTwo);的方式进行碎片切换的. 解决方案是使用add和show.hide方法组合实现碎片的切换(应该是显示.隐藏 ...

  4. idea调试SpringMvc, 出现:”javax.servlet.ServletException: java.lang.IllegalStateException: Cannot create a session after the response has been committed"错误的解决方法

    调试拦截器出现以下错误: HTTP Status 500 - javax.servlet.ServletException: java.lang.IllegalStateException: Cann ...

  5. Android 学习之异常总结--java.lang.IllegalStateException:Could not execute method of the activity

    在android学习过程中通常会遇到java.lang.IllegalStateException:Could not execute method of the activity这个错误:非法状态的 ...

  6. java.lang.IllegalStateException: You need to use a theme.appcompat theme (or descendant) with this activity

    错误描述:java.lang.IllegalStateException: You need to use a theme.appcompat theme (or descendant) with t ...

  7. 开发中遇到的问题(一)——java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

    1.错误描述: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) wit ...

  8. java.lang.IllegalStateException: Fragment bb{42261900} not attached to Activity

    A.处理异常java.lang.IllegalStateException: Fragment bb{42261900} not attached to Activity处理方式:由于在线程中调用Fr ...

  9. [Android Pro] java.lang.IllegalStateException: Fragment(XXFragment) not attached to Activity异常

    转载:http://blog.csdn.net/winson_jason/article/details/20357435 下边两个问题,是在开发中碰到的一些关于Fragment的偶发性的问题,今天时 ...

随机推荐

  1. python3练习100题——014

    这题卡了我一整天,然后还是看答案撸了一遍- 原题链接:http://www.runoob.com/python/python-exercise-example14.html 题目:将一个正整数分解质因 ...

  2. centos7 walle2瓦力部署教程

    项目部署上线,如果是单服务器,那么有多种方式可以部署,比如直接ftp上传,或者直接git去拉取,人工操作也不会花费精力和时间,但是如果采用了集群模式,有多台服务器,那么依靠一台一台的去上传代码,就显得 ...

  3. 【css】用css巧妙实现移动端横向滑动展示功能

    前言:记得以前处理移动端横向滑动展示都是去用js去解决的,要用js进行蛮多处理,要算li的宽度,然后还要用js设置ul盒子的宽度,又要设置最大滑动距离,最小滑动距离等等.......但是现在发现用cs ...

  4. es2.0的语法学习

    确定文档和查询有多么相关的过程被称为打分(scoring):将查询作为输入,使用不同的手段来确定每一篇文档的得分,将每一个因素最后通过公式综合起来,返回该文档的最终得分.这个综合考量的过程,就是我们希 ...

  5. 解决无法将“babel”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。

    错误截图: 第一反应想到的是环境变量没有配置好,再仔细检查一下,并没有错误 在cmd窗口运行命令“ babel --version ”,如果出现对应的版本号,那就说明环境变量是正确的 解决方案: 用管 ...

  6. input:file上传文件类型(记录)

    imput 属性有以下几种: 1.type:input类型这就不多说了2.accept:表示可以选择的文件类型,多个类型用英文逗号分开,常用的类型见下表. <input id="fil ...

  7. html表单提交给PHP然后浏览器显示出了PHP的源代码

    今天学习到PHP处理网页表单提交的数据时,碰到一个巨头疼的问题,先贴上案例代码: html表单部分: <html> <head> <meta charset=" ...

  8. AWS ec2的ubuntu14.04上安装git服务

    http://imerc.xyz/2015/11/13/Ubuntu-14-04%E4%B8%8AGit%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%9A%84%E6%90%AD%E5 ...

  9. 每天进步一点点------Allegro 修线

    Allegro中修线的方法有很多种,这里重点介绍走线的移动和走线的替换,掌握这两种方法,基本可以完成电路板的修线工作.  走线的移动 第1步:执行菜单命令Route->Slide,进入移动走线命 ...

  10. Linux中 /boot 目录介绍

    转自https://blog.csdn.net/dulin201004/article/details/7396968 一./boot/目录中的文件和目录 Linux系统在本地启动时,目录/boot/ ...