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 应用服务中间件 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.
558 0
|
3月前
|
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”?
32 1
|
8月前
|
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
【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
181 0
|
9月前
|
存储 前端开发 Java
【Java】If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
【Java】If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
129 0
|
10月前
|
Java 开发工具 Android开发
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.
|
11月前
|
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”?
|
SQL Java 关系型数据库
【已解决】Mybatis 批量动态更新数据时出现异常:java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax
【已解决】Mybatis 批量动态更新数据时出现异常:java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax
601 0
Java注解实现之how to use path variable @PathVariable
Java注解实现之how to use path variable @PathVariable
102 0
Java注解实现之how to use path variable @PathVariable
|
Java jenkins 持续交付
jenkins启动失败,提示Starting Jenkins Jenkins requires Java8 or later, but you are running 1.7.0
# 背景 centos安装jenkins后,先启动jenkins服务,结果报错如下: 但自己明明已经安装了java8的 # 解决方法 既然安装了java8的话,那么证明是jenkins启动的是还是用的旧的java7,需要修改jenkins启动引用的java版本,是在/etc/init.
3384 0