异常信息:

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. Educational Codeforces Round 81 (Rated for Div. 2) A-E简要题解

    链接:https://codeforces.com/contest/1295 A. Display The Number 贪心思路,尽可能放置更多位,如果n为奇数,消耗3去放置一个7,剩下的放1 AC ...

  2. CAN报文格式

    CAN协议的报文传输过程中有:数据帧.远程帧.错误帧.过载帧和帧间隔. 1.数据帧:用于发送节点向接收节点传送数据的帧. 2.远程帧:用于接收节点向具有相同ID的发送节点传送数据的帧. 3.错误帧:用 ...

  3. asmx 、Web Service、Web API

    asmx .Web Service.Web API asmx 是WEB服务文件 asmx.cs里有相关代码 属于B/S形式,用SOAP方式HTTP访问,用XML返回 可以返回基础类型和PUBLIC结构 ...

  4. hfs 文件存储

    hfs 服务器上面的和本地拖上去的文件是同一个文件.对本地文件拖上去之后再修改,服务器文件也会修改.所以服务器要有一个自己的文件存放.

  5. 每天进步一点点------Xilinx IP 内核

    ISE 设计套件 11.1 版本中提供了众多全新的 IP 内核.数学函数:Multiply Adder v2.0 —— 执行两个操作数的乘法,并采用 XtremeDSP™ 解决方案切片将完全精确的乘积 ...

  6. linux中systemctl详细理解及常用命令

    linux中systemctl详细理解及常用命令 https://blog.csdn.net/skh2015java/article/details/94012643 一.systemctl理解 Li ...

  7. python入门(二十讲):爬虫

    什么是爬虫? 按照一定的规则,自动地抓取万维网信息的程序或脚本. 爬虫目的: 从网上爬取出来大量你想获取类型的数据,然后用来分析大量数据的类似点或者其他信息来对你所进行的工作提供帮助. 为什么选择py ...

  8. 30分钟编写一个抓取 Unsplash 图片的 Python爬虫

       我一直想用 Python and Selenium 创建一个网页爬虫,但从来没有实现它. 几天前, 我决定尝试一下,这听起来可能是挺复杂的, 然而编写代码从 Unsplash 抓取一些美丽的图片 ...

  9. 001.Django_Model.整理

    Django001_Model.整理 Model表设计 数据定义数据存储,输出 a.定义表(信息 =字段) + 定义表关系 + (定义/限制)数据 b.通过orm等方法来,定义method来编辑原始数 ...

  10. 最详细的linux安装php过程

    本文主要和大家分享最详细的linux安装php过程,然后写好了nginx的安装配置,后面就是php的安装和mysql的安装,不过时间有限,而且放篇里也太长,所以都是分开来写,php安装完毕后就是mys ...