简体   繁体   English

棒棒糖上的Android Theme.Holo.Light.DarkActionBar

[英]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-v7Theme.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.

相关问题 android-Theme.Holo与DarkActionBar - android - Theme.Holo with DarkActionBar 如何为所有android应用程序设置Holo light主题 - How to set Holo light theme for all android application Theme.AppCompat.Light.DarkActionBar - 找不到资源 - Theme.AppCompat.Light.DarkActionBar - No resource found 检索项目的父项时出错:找不到与给定名称匹配的资源&#39;@android:style / Theme.AppCompat.Light.DarkActionBar&#39; - Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.AppCompat.Light.DarkActionBar' 为什么在 Android 的 Theme.MaterialComponents.Light.DarkActionBar 中没有应用按钮的全局颜色样式? - Why global color style for button is not being applied in Theme.MaterialComponents.Light.DarkActionBar in Android? 将actionBar主题更改为Holo.Light? - Changing actionBar theme to Holo.Light? 如何将应用程序图标应用于Theme.DeviceDefault.Light.DarkActionBar? - How to apply the app icon to the Theme.DeviceDefault.Light.DarkActionBar? Android:Theme Holo先前版本 - Android: Theme Holo previous version 检索主题theme.appcompat.light.darkactionbar的父项时出错 - error retrieving parent for item theme.appcompat.light.darkactionbar 自定义主题您必须使用Theme.Sherlock,Theme.Sherlock.Light,Theme.Sherlock.Light.DarkActionBar或衍生工具 - custom theme You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM