【发布时间】:2015-06-23 15:52:59
【问题描述】:
以下样式在eclipse中显示错误
<style name="AppTheme" parent="android:style/Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
<item name="colorControlNormal">@color/primary</item>
<item name="colorControlActivated">@color/primary</item>
<item name="colorControlHighlight">@color/primary</item>
</style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">@color/white</item>
</style>
显示这样的错误
error: Error retrieving parent for item: No resource found that matches the given name 'android:style/Theme.AppCompat.Light.NoActionBar'.
当我搜索时,我知道这是依赖关系的问题。我尝试了很多来解决它。但我仍然得到同样的错误。
如果我改变主题没有错误,但我需要这种特殊的风格。
我尝试了以下主题
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
// Your style here
这是醒了。但我需要上述主题。
【问题讨论】:
-
尝试添加 AppCompat 库
-
已经试过了。这对我不起作用
-
删除 android:style/ 并放入 parent="Theme.AppCompat.Light.NoActionBar">
-
嗯,它对我有用。我在我的依赖项中添加了 'com.android.support:appcompat-v7:+' 并且之前没有 android:style/appended。尝试重建您的项目
-
不幸的是不适合我。过去两天我被困在这个问题上。