所以我认为这是v22的一个常见问题,但目前的解决方案似乎并没有解决我的错误。我尝试将android:windowActionBar设置为false,将android:windowNoTitle设置为true,但这似乎没有帮助。
这是我的错误消息
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>
也许我只是输错了代码,所以希望有人可以指导我出错的地方。谢谢你的时间。
编辑:我之前已经问过这个问题,但目前所有解决方案都没有解决我的问题。我的问题没有得到解答,链接没有帮助。答案 0 :(得分:3)
删除Android前缀并扩展您的基本主题。
记住: AppCompat不需要Android前缀!
<style name="AppTheme.NoActionBar" parent="AppTheme">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>