Reputation: 43943
In my android xml code, I want to draw a background image for a relative layout:
I have a file called homeBackground.png
. But its not actually showing up when I run on my phone. If I look in the GUI editor for the layout, I can see the background.
Does anyone know what's wrong here?
Thanks.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
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"
android:background="@drawable/homeBackground"
tools:context=".ActivityCourses" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
</RelativeLayout>
EDIT:
Now I get this
[2013-10-13 02:21:10 - NAME] res\drawable-hdpi\homeBackground.png: Invalid file name: must contain only [a-z0-9_.]
Upvotes: 0
Views: 697
Reputation: 1042
Capital letters not allowed in resources files.
Instead of
homeBackground.png
rename the file name to:
home_background.png
Upvotes: 1