java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a

简介: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a

问题解决


报这个错的原因是activity继承了兼容包的类,比如ActionBarActivity,它来自android.support.v7.app.ActionBarActivity


方法一:把继承兼容包的类改为直接继承Activity


方法二 : 配合的AppCompat的theme使用


在AndroidManifest.xml加上

android:theme="@style/Theme.AppCompat.Light.NoActionBar"

然后在styles.xml中加入主题资源:

<style name="Theme.AppCompat.Light.NoActionBar" parent="@style/Theme.AppCompat.Light"> 
    <item name="android:windowNoTitle">true</item>
 </style>


相关文章
|
6月前
|
Java Windows
windows下 安装 Elasticsearch报错warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME
windows下 安装 Elasticsearch报错warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME
453 0
|
Java 应用服务中间件 nginx
【异常解决】java程序连接MinIO报错The request signature we calculated does not match the signature you provided.
【异常解决】java程序连接MinIO报错The request signature we calculated does not match the signature you provided.
1993 0
|
5月前
|
Java
springboot 异常java.net.BindException: Address already in use: bind
springboot 异常java.net.BindException: Address already in use: bind
67 0
|
6月前
|
定位技术 Android开发
Android 12蓝牙报java.lang.SecurityException: Need android.permission.BLUETOOTH_CONNECT permission
Android 12蓝牙报java.lang.SecurityException: Need android.permission.BLUETOOTH_CONNECT permission
242 1
|
5月前
|
Java
ElasticSearch启动报错 java version is an early-access build ,only use release builds【已解决】
ElasticSearch启动报错 java version is an early-access build ,only use release builds【已解决】
68 0
|
IDE Java 开发工具
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8的解决方案
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8的解决方案
|
6月前
|
Java
Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?
Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?
149 1
|
Java
JAVA 端口被占用 报错解决方案:java.net.BindException: Address already in use: bind
JAVA 端口被占用 报错解决方案:java.net.BindException: Address already in use: bind
235 0
|
Java
【Java异常】com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: can not use this method fo
【Java异常】com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: can not use this method fo
597 0
java.net.BindException: Address already in use: 解决方法
java.net.BindException: Address already in use: 解决方法
361 0
下一篇
无影云桌面