我想用重复图像设置线性布局的背景。 我有 2 个文件。
main_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/bg"
android:tileMode="repeat" />
和main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/main_bg"
>
并且我在可绘制文件夹中有 bg.png 图像。
但是 Eclipse 说有一个错误
错误:错误:找不到与给定名称匹配的资源(在“背景”中值为“@drawable/main_bg”)。
如何解决?
最佳答案
将 main_bg.xml 放在 drawable 文件夹中。那是在 res/drawable 中。
关于android - 如何修复android中的背景错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10266937/