I add the following code to main.xml to set an image as a background image for my app:
android:background="@drawable/bg"
So main.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android= "http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="bottom|fill_vertical"
android:background="@drawable/bg0"
>
<EditText
android:id="@+id/edWord"
android:layout_width="fill_parent"
android:layout_height="53px"
android:textSize="20px"
android:singleLine="true"
android:hint=""
/>
<LinearLayout xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical"
android:layout_weight="1"
>
<ListView android:id="@+id/lstWord"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
>
<ImageButton
android:id="@+id/btnGetText"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:src="@drawable/get"
android:layout_weight="0.25"
/>
<ImageButton
android:id="@+id/btnFind"
android:text="Click me..."
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:src="@drawable/find"
android:layout_weight="0.25"
/>
</LinearLayout>
</LinearLayout>
And of course the image bg.png is in drawable.
The problem is that the background image is shown only in the emulator but not in my actual device (HTC Desire).
What have I done wrong? What do I need to do to solve this problem?
Can you guys there help? Thank you very much.