Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am new to android. I am trying to set the background of my layout and keep getting an error. i have doubled checked but still having same problem. Below is my code.

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android">
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mylayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.hymnproject.HymnDisplay"
tools:ignore="UselessParent">

<linearlayout> android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:removed="@drawable/background"

android:layout_centerHorizontal="true"

android:orientation="vertical" >

<Button
android:id="@+id/menubutton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/return_to_hymn_menu"
android:textStyle="normal|italic" />

<scrollview>
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:padding="5dp" >

<textview>
android:id="@+id/hymnDisplay"
android:layout_width="match_parent"
android:layout_height="154dp"
android:gravity="center"
android:paddingLeft="10dp"
android:textStyle="italic" />





I also made sure i copied the backjground.png i am trying to use to all the 5 drawable folders.
Posted

1 solution

 
Share this answer
 
Comments
solomon201 16-Aug-14 7:16am    
Thanks for your response; I followed the steps on the link provided but keep getting this error

"Error: No resource found that matches the given name (at 'background' with value '@drawable/background_image')"
solomon201 16-Aug-14 7:34am    
Thanks Thanks I found my mistake.

I was adding the file from eclipse. So i manually copied it to the drawable folder and it worked. Thanks
Sandeep Londhe 16-Aug-14 7:35am    
keep the image name simple and put only image name in drawable forlder without .jpg

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900