IDE“无法解析@style/Theme.Appcompat"使用 v7 兼容性支持主题时 [英] IDE "Cannot Resolve @style/Theme.Appcompat" when using v7 compatibility support theme

查看:26
本文介绍了IDE“无法解析@style/Theme.Appcompat"使用 v7 兼容性支持主题时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这并不是什么大问题,因为我的项目仍然可以正确构建和运行(使用 gradle),但是我无法让 Android Studio 识别 API 18 SDK 中发布的应用程序兼容性主题(用于允许操作栏支持)适用于 android 2.1 及更高版本).

This is not really a huge issue, as my project still builds and runs correctly (using gradle), but I'm having trouble getting Android Studio to recognize the application compatibility theme released in the API 18 SDK (for allowing actionbar support for android 2.1 and above).

我已经成功加载了支持库,因为 Java 文件中的 ActionBar 类可以完成代码.问题是 Android Studio 在 AndroidManifest.xml 中为 Theme.AppCompat.Light 的分配显示红色文本错误.

I have the support libraries loading successfully, because code completion is possible for the ActionBar classes in java files. The issue is that Android studio shows red text errors for assignments to the Theme.AppCompat.Light in the AndroidManifest.xml.

有没有办法为 Android Studio 中的外部库的清单中声明的​​主题资源启用代码完成?

Is there a way to enable code completion for theme resources declared in the manifest from external libraries in Android Studio?

更新 这是我的 AndroidManifest 中的 块:

Updated Here is my <activity> block from my AndroidManifest:

<activity
    android:name="com.example.activities.MainActivity"
    android:label="@string/app_name"
    android:screenOrientation="portrait"
    android:theme="@style/Theme.AppCompat.Light" >

我也试过在应用程序块中设置主题:

I've also tried setting the theme in the application block:

<application
    android:allowBackup="true"
    android:icon="@drawable/main_final_ic"
    android:label="@string/app_name"
    android:logo="@drawable/main_final_enzo"
    android:theme="@style/Theme.AppCompat.Light" >

同样,这些都可以工作并且编译正常,但在我的 IDE 中显示为带有错误的红色文本.我也刚刚确认在 eclipse 中运行我的项目时发生了同样的问题.

Again, these both work and compile OK, but appear as red text with errors in my IDE. I've also just confirmed that the same issues are occurring when running my project in eclipse.

推荐答案

Android Studio v0.2.7 中已修复此问题.

This problem was fixed in Android Studio v0.2.7.

这篇关于IDE“无法解析@style/Theme.Appcompat"使用 v7 兼容性支持主题时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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