未找到 LinearLayout 背景

LinearLayout background not found

我知道这张背景图片存在,它位于以下 drawable 文件夹中:

该文件被命名为 coming_up.9.png,因为它是一个九补丁,我知道这行得通,因为我对其他一些图像也做了同样的事情。

布局XML

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/coming_up">

错误

Error:(213, 37) No resource found that matches the given name (at 'background' with value '@drawable/coming_up').

我处理这个问题已经有一段时间了,我决定今天是解决它的日子。这是我解决问题的方法:

我的步数:

  1. 将背景更改为名为 @drawable/checkbox_checked 的不同(工作)图像以查看会发生什么 - 应用程序 运行 使用新图像很好
  2. 在我的资源文件夹 /res 中搜索 checkbox_checked 以查看它存在的位置
  3. 发现 checkbox_checked.png 仅在主 /drawable 文件夹中
  4. /drawable-mdpi 复制 coming_up.9.png/drawable - 仍然是同样的错误
  5. 已将 coming_up.9.png 重命名为 coming_up.png - 有效
  6. 已将 coming_up.png 重命名为 coming_up.9.png - 仍然有效
  7. /drawable 中删除了 coming_up.9.png,同时将其留在我所有其他可绘制文件夹中 - 有效

这似乎是 Android Studio 的一个错误,已在第 5 步以某种方式解决。不管这个问题是否已解决,所以我希望这可以节省一些人解决问题的时间。