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 ...
随机推荐
- app 下载更新 file-downloader 文件下载库的简单介绍和使用
app 下载更新 file-downloader 文件下载库的简单介绍和使用 今天介绍一个下载库:file-downloader 文件下载库 说明: * 本文内容来自原 file-downloader ...
- [LeetCode] Reach a Number 达到一个数字
You are standing at position 0 on an infinite number line. There is a goal at position target. On ea ...
- CentOS6.9安装
我安装在VM的虚拟机中.具体安装方式网上很多,由于本机只能安装32位的linux系统,所以悬在了Centsos6.9版本.点此下载. 其中有一种是叫做LIVEDVD的版本,这种的值虚拟机中配置后,打开 ...
- 获取Avrix上Computer Vision and Pattern Recognition的论文,进一步进行统计分析。
此文主要记录我在18年寒假期间,收集Avrix论文的总结 寒假生活题外 在寒假期间,爸妈每天让我每天跟着他们6点起床,一起吃早点收拾,每天7点也就都收拾差不多. 早晨的时光是人最清醒的时刻,而 ...
- STL rope
rope的部分简单操作 函数 功能 push_back(x) 在末尾添加x insert(pos,x) 在pos插入x erase(pos,x) 从pos开始删除x个 replace(pos,x) 从 ...
- UVA 11584 划分回文字串
将其划分为尽可能少的回文串 dp[i] = min(dp[i],dp[j] + 1) 来表示j+1~i是回文串 #include <iostream> #include <cs ...
- bzoj 2212: [Poi2011]Tree Rotations
Description Byteasar the gardener is growing a rare tree called Rotatus Informatikus. It has some in ...
- (⊙o⊙)…
参考:ACdreamers a > b,GCD(a,b) = 1 => GCD(a^m-b^m,a^n-b^n) = a^GCD(n,m) - b^GCD(n,m) /*没有找到推理过程Q ...
- [BZOJ]1011 遥远的行星(HNOI2008)
由eps引发的血案. Description 直线上N颗行星,X=i处有行星i,行星J受到行星I的作用力,当且仅当i<=A*J.此时J受到作用力的大小为 Fi->j=Mi*Mj/(j-i) ...
- npm run dev 出错的解决办法
bogon:~ yan$ cd my-project bogon:my-project yan$ npm run dev > my-project@1.0.0 dev /Users/yan/my ...