异常信息:

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. LitElement(四)属性

    1.概述 LitElement管理您声明的属性及其对应的属性.默认情况下,LitElement将: 确保在任何声明的属性更改时进行元素更新. 捕获已声明属性的实例值.在浏览器注册自定义元素定义之前设置 ...

  2. 三剑客-sed awk

     目录 1.sed 2.awk 1.sed //sed命令 #语法说明:命令 参数 条件+处理= (指令) 处理文件信息 字符流编辑工具(行编辑工具)==按照每行中的字符进行处理操作 ). 擅长对行进 ...

  3. C语言 fputs

    C语言 fputs #include <stdio.h> int fputs(const char * str, FILE * stream); 功能:将str所指定的字符串写入到stre ...

  4. WOW Factor

    Recall that string aa is a subsequence of a string bb if aa can be obtained from bb by deletion of s ...

  5. Java 字符串、数值与16进制相互转化

    字符串.数值与16进制相互转化 首先创建一个工具类: package c; public class DataUtils { /* * 字节数组转16进制字符串 */ public static St ...

  6. awk从放弃到入门(1):awk基础

    一.awk简介 awk其名称得自于它的创始人 Alfred Aho .Peter Weinberger 和 Brian Kernighan 姓氏的首个字母.实际上 AWK 的确拥有自己的语言: AWK ...

  7. dbShape

    Usage: dbShape [-help] [-d] [-step <step>] [-output {polygon rect hrect area}] <shapeList&g ...

  8. set_set_switching_activity

    set_switching_activity  -static   0.2   -toggle_rate   20 -period  1000 [all_inputs] 这时,翻转率设置的节点是输入, ...

  9. vue项目中解决跨域问题axios和

    项目如果是用脚手架搭建的(vue cli)项目配置文件里有个proxyTable proxyTable是vue-cli搭建webpack脚手架中的一个微型代理服务器,配置如下 配置和安装axios 安 ...

  10. SQL更新语句的执行

    联系上文SQL查询语句的执行 查询语句的那一套流程,更新语句也是同样会走一遍. 更新流程还涉及两个重要的日志模块: ​ redo log(重做日志)和 binlog(归档日志) redo log:重做 ...