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
异常信息:
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的更多相关文章
- This Activity already has an action bar supplied by the window decor
问题描写叙述:继承自AppCompatActivity,使用Toolbar替代ActionBar的时候.出现错误 错误信息: 2.Caused by: java.lang.IllegalStateEx ...
- 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_ ...
- Fragment碎片频繁来回切换的时候报java.lang.IllegalStateException: No activity
出现这个问题的原因是因为使用的transcation.replace(fragmentTwo);的方式进行碎片切换的. 解决方案是使用add和show.hide方法组合实现碎片的切换(应该是显示.隐藏 ...
- 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 ...
- Android 学习之异常总结--java.lang.IllegalStateException:Could not execute method of the activity
在android学习过程中通常会遇到java.lang.IllegalStateException:Could not execute method of the activity这个错误:非法状态的 ...
- 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 ...
- 开发中遇到的问题(一)——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 ...
- java.lang.IllegalStateException: Fragment bb{42261900} not attached to Activity
A.处理异常java.lang.IllegalStateException: Fragment bb{42261900} not attached to Activity处理方式:由于在线程中调用Fr ...
- [Android Pro] java.lang.IllegalStateException: Fragment(XXFragment) not attached to Activity异常
转载:http://blog.csdn.net/winson_jason/article/details/20357435 下边两个问题,是在开发中碰到的一些关于Fragment的偶发性的问题,今天时 ...
随机推荐
- 解决使用git出现 The file will have its original line endings in your working directory
执行以下命令即可解决 git rm -r --cached . git config core.autocrlf false git add . . 代表当前目录
- 操作系統3-內存管理(Linux內存管理)
操作系統3-內存管理(Linux系統的內存管理方法) 9.Linux系統的內存管理方法 Linux採用"按需調頁"算法,支持三層管理策略.由於Intel CPU在硬件級提供了段式存 ...
- BigInteger和BigDecimal的基本用法
整型大数 BigInteger: import java.math.BigInteger; import java.util.Scanner; public class Main { public s ...
- 快捷键(一):Win10
Ctrl + X 剪切选定项 Ctrl + C(或 Ctrl + Insert) 复制选定项 Ctrl + V(或 Shift + Insert) 粘贴选定项 Ctrl + Z 撤消操作 Alt + ...
- windows 下安装memcache拓展
Windows下安装memcached (linux 接下来会继续 学习) 以管理员身份进入CMD 模式,具体方法:C:/windows/system32 管理员身份打开cmd.exe memcach ...
- POJ 3177 Redundant Paths (tarjan边双连通分量)
题目连接:http://poj.org/problem?id=3177 题目大意是给定一些牧场,牧场和牧场之间可能存在道路相连,要求从一个牧场到另一个牧场要有至少两条以上不同的路径,且路径的每条pat ...
- IntelliJ IDEA 2017.3尚硅谷-----如何创建模块
- springmvc validator和springContext validator的区别
1.springContext validator 依赖于代理实现 MethodValidationInterceptor Set<ConstraintViolation<Object&g ...
- 【代码审计】seacms 前台Getshell分析
一.漏洞分析 漏洞触发点search.php 211-213行 跟进parseIf 函数 ./include/main.class.php 这里要注意 3118行的位置,可以看到未做任何处理的eval ...
- X86现代汇编·02
下面4这个寄存器只能用16位或3N位名称访问3N位寄存器 :ESI EDI EBP ESP 16位寄存器: SI DI BP SP 特殊用法:乘除指令默认用EAX默认使用ECX为循环计数器ESP用于寻 ...