Ich habe ein neues Projekt für die L-Vorschau erstellt. Die Starter-Aktivität, die das sdk erzeugt erstreckt ActionBarActivity aber, wenn ich versuche, die nackten Knochen erzeugt Aktivität zu laufen, es wirft die folgende Ausnahme:So verwenden Sie ActionBarActivity mit Theme.Material
Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:110)
at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:57)
at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:99)
Ich habe umsah aber Theme.AppCompat.Material
scheint nicht zu existieren . Wie mache ich ActionBarActivity, um die neuen Material-Themen zu nutzen?
Mein build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-L'
buildToolsVersion '20.0.0'
defaultConfig {
applicationId 'com.sdchang.example'
minSdkVersion 'L'
targetSdkVersion 'L'
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.+'
compile 'com.mcxiaoke.volley:library:[email protected]'
compile 'com.google.code.gson:gson:2.2.+'
compile 'com.squareup.okhttp:okhttp:2.0.+'
}
21 + 's '' Theme.AppCompat' erstreckt Theme.Base.AppCompat' der sich '' Theme.Platform.AppCompat' denen sich android: Theme.Material 'auf 21+ Geräten (dh Android L) Geräte. – ianhanniballake
Vielen Dank, das hat mein Problem gelöst. Könnten Sie eine Antwort erstellen, damit es klar ist? –