简体   繁体   English

Android ActionBar-样式错误,但添加了AppCompat

[英]Android ActionBar - style error, but AppCompat added

I'm new to Android programming. 我是Android编程的新手。 I want to use Android Studio (I have the newest one, version 0.8.2), and style my Action Bar. 我想使用Android Studio(我拥有最新的版本0.8.2),并为操作栏设置样式。

The Gradle throws the following error during the build process: Gradle在构建过程中引发以下错误:

Error:Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.AppCompat.Light.DarkActionBar'.

Here's my style.xml file: 这是我的style.xml文件:

<resources>
<!-- Base application theme. -->
<style
    name="AppTheme"
    parent="@android:style/Theme.AppCompat.Light.DarkActionBar">
    <item name="android:actionBarStyle">@style/SocialExitActionBar</item>
</style>
<style
    name="SocialExitActionBar"
    parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">@drawable/tranparent</item>
</style>
</resources>

It's the same as the Google's documentation . Google的文档相同。 In every question, I found, the answer was to add the appcompat Library. 我发现,在每个问题中,答案都是添加appcompat库。 But I have the appcompat library added in my build.gradle file: 但是我在build.gradle文件中添加了appcompat库:

apply plugin: 'com.android.application' 应用插件:“ com.android.application”

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"
    defaultConfig {
        applicationId "com.procode.socialexit"
        minSdkVersion 11
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.+'
}

Here's on pic: 图片如下: 项目依赖 link 链接

Thanks for your help! 谢谢你的帮助!

我必须在每个父值之前删除@android:style/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM