2015-05-13 150 views
0

所以我認爲這是v22的一個常見問題,但目前的解決方案似乎不能解決我的錯誤。我試着將android:windowActionBar設置爲false,android:windowNoTitle設置爲true,但這似乎沒有幫助。Android Studio錯誤「AppCompat不支持主題」

這是我的錯誤信息

05-13 07:33:50.943: E/AndroidRuntime(14440): FATAL EXCEPTION: main 
05-13 07:33:50.943: E/AndroidRuntime(14440): Process: com.commonsware.lorem, PID: 14440 
05-13 07:33:50.943: E/AndroidRuntime(14440): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.commonsware.lorem/com.commonsware.lorem.Lorem}: java.lang.IllegalArgumentException: AppCompat does not support the current theme features 
05-13 07:33:50.943: E/AndroidRuntime(14440): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2198) 
05-13 07:33:50.943: E/AndroidRuntime(14440): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257) 
05-13 07:33:50.943: E/AndroidRuntime(14440): at android.app.ActivityThread.access$800(ActivityThread.java:139) 
05-13 07:33:50.943: E/AndroidRuntime(14440): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210) 
05-13 07:33:50.943: E/AndroidRuntime(14440): at android.os.Handler.dispatchMessage(Handler.java:102) 
05-13 07:33:50.943: E/AndroidRuntime(14440): at android.os.Looper.loop(Looper.java:136) 
05-13 07:33:50.943: E/AndroidRuntime(14440): at android.app.ActivityThread.main(ActivityThread.java:5097) 
05-13 07:33:50.943: E/AndroidRuntime(14440): at java.lang.reflect.Method.invokeNative(Native Method) 
05-13 07:33:50.943: E/AndroidRuntime(14440): at java.lang.reflect.Method.invoke(Method.java:515) 
05-13 07:33:50.943: E/AndroidRuntime(14440): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
05-13 07:33:50.943: E/AndroidRuntime(14440): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
05-13 07:33:50.943: E/AndroidRuntime(14440): at dalvik.system.NativeStart.main(Native Method) 
05-13 07:33:50.943: E/AndroidRuntime(14440): Caused by: java.lang.IllegalArgumentException: AppCompat does not support the current theme features 
05-13 07:33:50.943: E/AndroidRuntime(14440): at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:360) 
05-13 07:33:50.943: E/AndroidRuntime(14440): at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:246) 
05-13 07:33:50.943: E/AndroidRuntime(14440): at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106) 
05-13 07:33:50.943: E/AndroidRuntime(14440): at com.commonsware.lorem.Lorem.onCreate(Lorem.java:35) 
05-13 07:33:50.943: E/AndroidRuntime(14440): at android.app.Activity.performCreate(Activity.java:5248) 
05-13 07:33:50.943: E/AndroidRuntime(14440): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110) 
05-13 07:33:50.943: E/AndroidRuntime(14440): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162) 

這裏是我的styles.xml

<resources> 

    <!-- Base application theme. --> 
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
     <!-- Customize your theme here. --> 
    </style> 

    <style name="AppTheme.NoActionBar"> 
     <item name="android:windowActionBar">false</item> 
     <item name="android:windowNoTitle">true</item> 
    </style> 

</resources> 

也許我只是輸入代碼錯誤,所以希望有人能指導我什麼錯誤。感謝您的時間。

編輯:我知道這個問題已經問過,但所有當前的解決方案都沒有解決我的問題。我的問題沒有得到解答,鏈接也沒有幫助。

回答

3

刪除android前綴並擴展您的基本主題。

切記:AppCompat不需要android前綴!

<style name="AppTheme.NoActionBar" parent="AppTheme"> 
    <item name="windowActionBar">false</item> 
    <item name="windowNoTitle">true</item> 
</style> 
+0

嗯,我添加了這些變化,它似乎仍然給出了相同的錯誤。 – gunR

相關問題