错误描述为:

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.的更多相关文章

  1. android studio :com.android.support:appcompat-v7:21.+ 报错

    android studio :com.android.support:appcompat-v7:21.+ 报错: 在project——>app——>build.gradle修改: app ...

  2. Android Studio:xxx is not an enclosing class 错误的解决方法

    Android Studio:xxx is not an enclosing class 错误的解决方法 这个问题一般出现在内部类中,若要创建内部类的实例,需要有外部类的实例才行,或者是将内部类设置为 ...

  3. 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 ...

  4. 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 ...

  5. 我的Android进阶之旅------>解决错误:You need to use a Theme.AppCompat theme (or descendant) with this activity.

    #1.错误描述 今天,想实现Activity不显示标题栏的效果,在项目的AndroidManifest.xml文件,对相应的Activity添加属性 android:theme="@andr ...

  6. android对话框显示异常报错:You need to use a Theme.AppCompat theme (or descendant) with this activity.

    今天写android实验碰到到一个问题,在用AlertDialog.Builder类构建一个对话框之后,调用Builder.show()方法时抛出异常如下: - ::-/xyz.qlrr.sqlite ...

  7. 报错:You need to use a Theme.AppCompat theme (or descendant) with this activity.

    学习 Activity 生命周期时希望通过 Dialog 主题测试 onPause() 和 onStop() 的区别,点击按钮跳转 Activity 时报错: E/AndroidRuntime: FA ...

  8. 【我的Android进阶之旅】解决bug:You need to use a Theme.AppCompat theme (or descendant) with this activity.

    前言 今天用Android Studio 生成Activity的时候,默认继承AppCompatActivity ,而在AndroidManifest.xml我对该Activity设置了一个主题,然后 ...

  9. 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 ...

随机推荐

  1. Hive函数:CUME_DIST,PERCENT_RANK

    参考自:大数据田地http://lxw1234.com/archives/2015/04/185.htm 数据准备: d1,user1, d1,user2, d1,user3, d2,user4, d ...

  2. 给定了经纬度的一张my_latlng表,和一个my_grid表,怎么实现my_latlng表回mygrid中的id?

    场景: 假设我们拥有一个拥有了一系列经纬度的表my_latlng(lat string,lng string)表,还有一张给定的栅格表my_grid(gridid bigint,centerlng d ...

  3. BeautifulSoup重点复习

    html = """ <html><head><title>The Dormouse's story</title>< ...

  4. STL之map排序

    描述 STL的map中存储了字符串以及对应出现的次数,请分别根据字符串顺序从小到大排序和出现次数从小到大排序. 部分代码已经给出,请补充完整,提交时请勿包含已经给出的代码. int main() { ...

  5. SQL发音考(搜寻SQL-86标准)

    据我观察,中国的开发者创造了一种独特的SQL发音:/'sɜːkl/,既好听,又好读,挺好的.但是今年我开始做数据库相关的工作,作为一个专业人士,决定对SQL发音进行一些考证. 直接说结论吧,很多人沿用 ...

  6. [LeetCode] Find Duplicate File in System 在系统中寻找重复文件

    Given a list of directory info including directory path, and all the files with contents in this dir ...

  7. STM32 - SYSTICK(系统滴答定时器)

    SysTick定时器被捆绑在NVIC中,用于产生SYSTICK异常(异常号:15).在以前,大多操作系统需要一个硬件定时器来产生操作系统需要的滴答中断,作为整个系统的时基.例如,为多个任务许以不同数目 ...

  8. [HAOI2015]数字串拆分

    题目描述 你有一个长度为n的数字串.定义f(S)为将S拆分成若干个1~m的数的和的方案数,比如m=2时,f(4)=5,分别为4=1+1+1+1你可以将这个数字串分割成若干个数字(允许前导0),将他们加 ...

  9. bzoj 5290: [Hnoi2018]道路

    Description Solution PJDP毁青春 注意到性质:到根的道路不超过 \(40\) 条 所以我们只关系一个点上面的道路的情况就行了 设 \(f[x][i][j]\) 表示一个点 \( ...

  10. NOIP2014-10-30模拟赛

    T1:逗比三角形 [题目描述] 小J是一名OI退役滚粗文化课选手,他十分喜欢做题,尤其是裸题.他现在有一个二维盒子和一些二维三角形,这个盒子拥有无限的高度和L的宽度.而且他的三角形也都是一些锐角三角形 ...