Reputation: 43
i want to set background of linearlayout with repeating image. i have 2 files.
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" />
and 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"
>
and i've bg.png image on folder drawable.
But Eclipse says there's an error
error: Error: No resource found that matches the given name (at 'background' with value '@drawable/main_bg').
How to fix it?
Upvotes: 4
Views: 2985
Reputation: 34765
Place main_bg.xml in drawable folder. That is in res/drawable.
Upvotes: 2
Reputation: 9705
It looks like Android can't find the drawable resource. All drawables (including those defined by XML) should be in res/drawable .
Upvotes: 0
Reputation: 3150
main_bg.xml should be in drawable folder. Looking at the error I guess it's saved somewhere else.
Upvotes: 1