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 this activity.
起因:
我想在Manifest中设置我的activity全屏,代码如下:
activity android:name=".SplashActivity"
android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen">
原因:
从错误提示中提到Theme.AppCompat theme,这是因为我们的activity一定是继承了兼容包中的类,
比如我这里默认继承了AppCompatActivity,它来自android.support.v7.app.AppCompatActivity。
所以就要使用与其配合的AppCompat的theme才行。
解决:
方法1.根据提示来使用AppCompat的theme,如下:
ndroid:theme="@style/Theme.AppCompat.NoActionBar"
方法2:
如果不是那么强烈需要继承自ActionBarActivity,就直接继承Activity吧。问题自然搞定!
Android Studio: You need to use a Theme.AppCompat theme (or descendant) with this activity.的更多相关文章
- android studio :com.android.support:appcompat-v7:21.+ 报错
android studio :com.android.support:appcompat-v7:21.+ 报错: 在project——>app——>build.gradle修改: app ...
- Android Studio:xxx is not an enclosing class 错误的解决方法
Android Studio:xxx is not an enclosing class 错误的解决方法 这个问题一般出现在内部类中,若要创建内部类的实例,需要有外部类的实例才行,或者是将内部类设置为 ...
- 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:真机调试遇到的问题(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进阶之旅------>解决错误: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 ...
- 【我的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.
错误描述为:java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with ...
随机推荐
- python三元操作符
#比较大小更简单了 x,y=3987,24361 small=(x if x<y else y) print(small) #方法一:比较三个数的大小找出较大的一个 x,y,z=8,1,13 ...
- 用 k8s 管理机密信息 - 每天5分钟玩转 Docker 容器技术(155)
应用启动过程中可能需要一些敏感信息,比如访问数据库的用户名密码或者秘钥.将这些信息直接保存在容器镜像中显然不妥,Kubernetes 提供的解决方案是 Secret. Secret 会以密文的方式存储 ...
- java中关于&、&&、|、||之间的区别和运算
关于&.&&.|.||之间的区别和运算 在逻辑运算中: 普通与&:要判断所有的判断的条件 短路与&&:如果前面一个判断条件出现false,则后续的判断条 ...
- C++ 前期准备
在线编译网站: http://www.dooccn.com/cpp/ 刷题: https://leetcode.com/ https://leetcode-cn.com/
- [LeetCode] Optimal Division 最优分隔
Given a list of positive integers, the adjacent integers will perform the float division. For exampl ...
- javascript的基础(2)--数据类型介绍
1. number数据类型 所有的数字都是Number数据类型 利用typeof运算符可以返回当前数据的数据类型 特殊值:NaN not a number 不是一个数字 注意 :小数的计算可能产生丢失 ...
- [Luogu 2816]宋荣子搭积木
Description saruka非常喜欢搭积木,他一共有n块积木.而且saruka的积木很特殊,只能一块块的竖着摞,可以摞很多列.说过saruka的是特殊的积木了,这些积木都非常智能,第i块积木有 ...
- [HAOI 2016]食物链
Description 如图所示为某生态系统的食物网示意图,据图回答第1小题. 1.数一数,在这个食物网中有几条食物链( ) 现在给你n个物种和m条能量流动关系,求其中的食物链条数. 物种的名称为从1 ...
- UVA1658:Admiral
题意:给定一个有向带权图,求两条不相交(无公共点)的路径且路径权值之和最小,路径由1到v 题解:这题的关键就在于每个点只能走一遍,于是我们想到以边换点的思想,用边来代替点,怎么代替呢? 把i拆成i和i ...
- Codeforces Round #452 F. Letters Removing
Description Petya has a string of length n consisting of small and large English letters and digits. ...