[英]android Theme.Holo.Light.DarkActionBar on lollipop
I create new project (api14-api21) in android studio 1.02. 我在Android Studio 1.02中创建了新项目(api14-api21)。 I change 1 line, from: 我从以下位置更改1行:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
in styles.xml to: 在styles.xml中:
<style name="AppTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
and i have this: 我有这个:
Process: pl.xxx.myapplication, PID: 5433
java.lang.RuntimeException: Unable to start activity ComponentInfo{pl.xxx.myapplication/pl.xxx.myapplication.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
It's possible to fix this? 可以解决这个问题吗? I would like to use Theme.Holo. 我想使用Theme.Holo。
If you are not going to use appcompat-v7
and Theme.AppCompat
, you need to: 如果您不打算使用appcompat-v7
和Theme.AppCompat
,则需要:
inherit from Activity
(or, really, anything other than ActionBarActivity
) 从Activity
继承(或者实际上是从ActionBarActivity
继承的任何东西)
change any menu resources to use android:
instead of app:
for things like android:showAsAction
更改所有菜单资源以使用android:
而不是app:
进行类似android:showAsAction
in addition to changing your theme, as you did. 除了像您一样更改主题外。
To be safe, and to reduce the size of your APK, you can also get rid of the dependency on appcompat-v7
from your app
module's build.gradle
file. 为了安全起见并减小APK的大小,您还可以摆脱app
模块的build.gradle
文件对appcompat-v7
的依赖。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.