Can't Find Theme.AppCompat.Light for New Android ActionBar Support

后端 未结 30 1840
误落风尘
误落风尘 2020-11-22 09:22

I am trying to implement the new ActionBar support library that was released by Google a couple days ago. In the past, I have successfully implemented ActionBarSherlock wit

相关标签:
30条回答
  • 2020-11-22 10:01

    For IntelliJ IDEA or Android Studio:

    Add this to app.gradle build file

    dependencies {
        compile "com.android.support:appcompat-v7:21.0.+"
    } 
    

    Replace -v:xx.0+, with your build target, if you have 19 platform then it must be like:

    dependencies {
        compile "com.android.support:appcompat-v7:19.0.+"
    }
    
    0 讨论(0)
  • 2020-11-22 10:02

    For Android Studio 1.2.2

    Drop "android" from the parent attribute value:

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"></style>
    
    0 讨论(0)
  • 2020-11-22 10:05

    You need to do next:

    1. File->Import (android-sdk\extras\android\support\v7). Choose "AppCompat"
    2. Project-> properties->Android. In the section library "Add" and choose "AppCompat"
    3. That is all!

    Note: if you are using "android:showAsAction" in menu item, you need to change prefix android as in the example http://developer.android.com/guide/topics/ui/actionbar.html

    0 讨论(0)
  • 2020-11-22 10:05

    I had the same issue and even after importing/adding a jar/library as mentioned in the answers it would not solve the error. Out of frustration, I just created a new workspace and created a fresh android project and it automatically imported appcompat_v7 and there were no errors on clean and build. Didn't have to import a single jar/ library manually. Just FYI I am using eclipse Mars.1 Release (4.5.1) and was facing the exact same issue everytime I created a new android project.

    0 讨论(0)
  • 2020-11-22 10:06

    Since the Import dialouge is different in Android Studio 1.0.1, I could't get Svyatoslav Lobachs version to work.

    Instead I downloaded "Android Support Repository" in the SDK Manager. Then added

    dependencies {
    ...
    compile "com.android.support:appcompat-v7:18.0.+"
    }
    

    to build.gradle. Worked for me.

    0 讨论(0)
  • 2020-11-22 10:06

    Quickest solution :

    right click on the project - > Android tools -> Add support library..

    enter image description here

    0 讨论(0)
提交回复
热议问题