Marcel Höll Marcel Höll -4 years ago 80
Java Question

Background image not set if using RelativeLayout

I have a problem setting the background IMAGE for the RelativeLayout. I have the following layout:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_relative_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
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=".MainActivity" >
</RelativeLayout>


The problem is, that the background image is shown in the emulator, but not on the phone itself. It is a Galaxy S4. Any suggestions?

Answer Source

make Height and Width fill_parent:

android:layout_width="fill_parent"
    android:layout_height="fill_parent"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download