Android:无法解析appcompat-v7主题 [英] Android: cannot resolve appcompat-v7 themes

查看:74
本文介绍了Android:无法解析appcompat-v7主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

themes.xml中,我想将主题从Theme.Holo.Light.DarkActionBar更改为Theme.AppCompat.Light.DarkActionBar

In themes.xml, I would like to change a theme from Theme.Holo.Light.DarkActionBar to Theme.AppCompat.Light.DarkActionBar

但我得到:

无法解析符号 '@android:style/Theme.AppCompat.Light.DarkActionBar'

cannot resolve symbol '@android:style/Theme.AppCompat.Light.DarkActionBar'

在gradle文件中,我添加了:

In the gradle file I added:

compile 'com.android.support:appcompat-v7:22.1.1'

我正在使用:

compileSdkVersion 22
buildToolsVersion "22.0.1"

我也运行过gradle的clean命令,但似乎没有任何改变.

I have also run gradle's clean command, but nothing seems to change.

有什么想法吗?

推荐答案

AppCompat主题不是内置样式的一部分.您必须引用不带'@android:style'前缀的它们.

The AppCompat themes are not part of the built-in styles. You have to reference them without the '@android:style' prefix.

只需使用以下内容:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

这篇关于Android:无法解析appcompat-v7主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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