java - Android Studio 无法解析符号

标签 java android xml

我正在使用 Android studio,实际上我正在设计操作栏。

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/MyActionBar</item>

    </style>

    <style name="MyActionBar"
           parent="android:Theme.Holo.Light.DarkActionBar">
        <item name="android:background">@color/oranzova</item>
        <item name="android:icon">@drawable/ic_launcher.png</item>
    </style>


</resources>

我仍然收到错误:

Error:(12, 35) No resource found that matches the given name (at 'android:icon' with value '@drawable/ic_launcher.png').

但无论我使用哪种资源。如果我使用 @raw/icon.png 我仍然得到同样的错误。我尝试使缓存无效/重新启动但没有帮助。

最佳答案

资源文件不需要像 *.png 这样的文件扩展名。所以只需改变你的行:

<item name="android:icon">@drawable/ic_launcher.png</item>

<item name="android:icon">@drawable/ic_launcher</item>

关于java - Android Studio 无法解析符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25833078/

相关文章:

java - 使用 getServletConfig 获取文件名时出错

java - RealmObjects 的位置在删除时改变

android - 在没有自定义 View 的情况下将 editText 放在 AlertDialog 中?

android - 选择器中的 9-Patch 显示黑点

android - Picasa 安卓集成

php - 从 MySQL 数据库生成 RSS 提要

java - JSF 和 PostgreSQL 中拉丁美洲和西类牙最常见的语言环境配置是什么?

java - 从可执行 jar 创建随处安装启动器

c# 列表内列表 XML Linq

android - TextInputLayout启用= false后如何使TextInputEditText中的文本变为灰色?