异常信息:

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. 数据库之一、数据库简介及SQL概要

    1.数据库简介: 数据库(Database,DB)是一个长期存储在计算机内的.有组织的.有共享的.统一管理的数据集合.简单来讲就是可以放大量数据的地方.管理数据库的计算机系统称为数据库管理系统(Dat ...

  2. Atcoder Beginner Contest 155E(DP)

    #definde HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ]; int main(){ ios: ...

  3. Codeforces Round #619 (Div. 2)C(构造,容斥)

    #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; int main(){ ios::syn ...

  4. Python小白的零碎记录

    1 3.7往后iterable .iterator包都包含在collections.abc中了,记录一下 from collections.abc import Iterable,Iterator p ...

  5. MNIST数据集环境搭建

    由于换了电脑,ubuntu是重新下载的,因此记录一些相关数据集的搭建: 首先是data数据集,在第七讲中 我们需要建立data文件夹,并将数据集放进去 再就是model模型 我们应该新建一个model ...

  6. C 语言实现面向对象编程

    转载 https://blog.csdn.net/onlyshi/article/details/81672279 C 语言实现面向对象编程1.引言面向对象编程(OOP)并不是一种特定的语言或者工具, ...

  7. CTF_论剑场 名侦探柯南

    首先看一下是一个压缩包然后下载 解压后会发现一个图片和另一个压缩包 打开图片 发现是这个 用HxD分析一下这张图片通过搜索 zip jpg...... 然后会发现这张图片里有一个png 图片 所以判断 ...

  8. pods " xxxx" not found错误

    pods " xxxx" not found错误 待办 https://linuxacademy.com/community/show/29447-pod-is-not-found ...

  9. 关于mybatis中多参数传值

    如果前台单独传递多个参数,并且未进行封装,在mybatis的sql映射文件中需要以下标的形式表示传递的参数,从0开始 即:where name=#{0} and password =#{1}:0表示第 ...

  10. 题解【洛谷P5436】【XR-2】缘分

    题目背景 世间万物都置身于缘分编织的大网中.缘分未到,虽历经千劫,却不能相遇.缘分到了,在草原上都能等到一艘船.--<一禅小和尚> 题目描述 一禅希望知道他和师父之间的缘分大小.可是如何才 ...