Android 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 this activity.
起因:
我想在Manifest中设置我的activity全屏,代码如下:
<activity
android:name=".MainActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:label="@string/app_name" >
原因:
从错误提示中提到Theme.AppCompat theme,这是因为我们的activity一定是继承了兼容包中的类,
比如我这里就无意中继承了ActionBarActivity,它来自android.support.v7.app.ActionBarActivity。
所以就要使用与其配合的AppCompat的theme才行。
解决:
1.根据提示来使用AppCompat的theme,如下:
<activity
android:name=".MainActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:label="@string/app_name" >
http://blog.csdn.net/lincyang/article/details/42673151
2.如果不是那么强烈需要继承自ActionBarActivity,就直接继承Activity吧。问题自然搞定!
Android You need to use a Theme.AppCompat theme (or descendant) with this activity.的更多相关文章
- Android Studio:You need to use a Theme.AppCompat theme (or descendant) with this activity. AlertDialog
学习<第一行代码>的时候遇到的问题. Process: com.example.sevenun.littledemo, PID: 2085 java.lang.RuntimeExcepti ...
- Android Studio: 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 ...
- Android:真机调试遇到的问题(You need to use a Theme.AppCompat theme (or descendant) with this activity)
Android:真机调试遇到的问题(You need to use a Theme.AppCompat theme (or descendant) with this activity). 在调试&l ...
- 【我的Android进阶之旅】解决bug:You need to use a Theme.AppCompat theme (or descendant) with this activity.
前言 今天用Android Studio 生成Activity的时候,默认继承AppCompatActivity ,而在AndroidManifest.xml我对该Activity设置了一个主题,然后 ...
- 我的Android进阶之旅------>解决错误:You need to use a Theme.AppCompat theme (or descendant) with this activity.
#1.错误描述 今天,想实现Activity不显示标题栏的效果,在项目的AndroidManifest.xml文件,对相应的Activity添加属性 android:theme="@andr ...
- android对话框显示异常报错:You need to use a Theme.AppCompat theme (or descendant) with this activity.
今天写android实验碰到到一个问题,在用AlertDialog.Builder类构建一个对话框之后,调用Builder.show()方法时抛出异常如下: - ::-/xyz.qlrr.sqlite ...
- 报错:You need to use a Theme.AppCompat theme (or descendant) with this activity.
学习 Activity 生命周期时希望通过 Dialog 主题测试 onPause() 和 onStop() 的区别,点击按钮跳转 Activity 时报错: E/AndroidRuntime: FA ...
- You need to use a Theme.AppCompat theme
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dji.sdk.sample/com.dji.sdk.sa ...
- 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 ...
随机推荐
- Storm编译打包过程中遇到的一些问题及解决方法
作者: 大圆那些事 | 文章可以转载,请以超链接形式标明文章原始出处和作者信息 网址: http://www.cnblogs.com/panfeng412/archive/2013/11/30/som ...
- 配置FastDFS
一.安装 (一)下载FastDFS安装包 FastDFS官方论坛:http://www.csource.org 下载1:http://sourceforge.net/projects/fastdfs/ ...
- Leetcode Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The ...
- Codeforce - Runtime Error
Bahosain was trying to solve this simple problem, but he got a Runtime Error on one of the test case ...
- HDU 4738 Caocao's Bridges(Tarjan)
题目链接 #include <iostream> #include <cstring> #include <cstdio> #include <queue&g ...
- 升级OS X EI Capition 版本导致cocoapods 使用终端上pod: command not found
1)安装过cocoapods, 那么输入 : sudo gem install -n /usr/local/bin cocoapods 当然 上个步骤解决了我的 难题 2)首先在终端输入 gem so ...
- Java数组转成list,list转数组
下面介绍一下Java中数组和List集合如何互相转换. 数组转成list 第一种: String[] userid = {"aa","bb","cc& ...
- gcc 编译器参数
一.GCC编译过程 参考:http://hi.baidu.com/zengzhaonong/item/c00e079f500adccab625314f------------------------- ...
- 【android design】android常用设计资源
一.概述 大部分程序员擅长开发,但是对于设计却知之甚少.这直接导致,程序员在初期开发出来的应用(大多为兴趣或实用导向)中看不中用.因此,有必要搜集整合一些设计资源,这样既能减轻程序员在设计上所耗费的时 ...
- Hibernate框架配置
API package com.hanqi.test; import static org.junit.Assert.*; import org.hibernate.SessionFactory; ...