的是Android 5.0的RuntimeException与应用程序兼容性引起的:java.lang.IllegalStateException:您需要使用Theme.AppCompat主题 [英] Android 5.0 RuntimeException with AppCompat Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme

查看:459
本文介绍了的是Android 5.0的RuntimeException与应用程序兼容性引起的:java.lang.IllegalStateException:您需要使用Theme.AppCompat主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚创建使用Android项目<一个href=\"http://ux.stackexchange.com/questions/32877/what-is-this-side-menu-called-that-can-be-found-in-many-multi-touch-apps-and-wh\">(hamburger)抽屉与midSDKlevel集到Android-8。

I just created Android project using (hamburger) drawer with midSDKlevel set to android-8.

我第一次跑进<一个href=\"http://stackoverflow.com/questions/26431676/appcompat-v721-0-0-no-resource-found-that-matches-the-given-name-attr-andro\">appcompat-v7:21.0.0':没有资源的发现,给定的名称匹配:ATTR'机器人:actionModeShareDrawable问题

,然后在运行Android 5.0模拟器我的RuntimeException

, then running in Android 5.0 emulator I got RuntimeException

产生的原因:java.lang.IllegalStateException:你需要使用Theme.AppCompat主题(或后代)本活动

Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

\\程序\\ SRC \\主\\资源\\值-V21 \\ styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="AppTheme" parent="android:Theme.Material.Light">
    </style>
</resources>

Android清单

Android manifest

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MyActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

应该是什么确切的字符串材料设计与应用程序兼容性?

推荐答案

有活动能力和style.You之间的一个问题是使用ActionBarActivity但你必须Theme.Material.Light,你应该尝试主题.AppCompat在你的风格

There is a problem between activity and style.You are using ActionBarActivity but you have Theme.Material.Light ,you should try "Theme.AppCompat" in your style

这篇关于的是Android 5.0的RuntimeException与应用程序兼容性引起的:java.lang.IllegalStateException:您需要使用Theme.AppCompat主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆