Ross Larson
Ross Larson

Reputation: 2437

Android - Custom image as app background

I am attempting to us a png file that I have imported into the drawable-mdpi folder as my background. however, just setting it as the background through main.xml results in the process stopping unexpectedly when I attempt to run my app in the emulator.

Is there any step by step process I need to follow after setting the png file as the background in main.xml (I have also included my values/theme.xml below)

values/theme.xml

<resources>
    <style name="Theme.NoBackground" parent="android:Theme">
        <item name="android:windowBackground">@drawable/pioneer_lift</item>
        <item name="android:textColor">#000000</item>
    </style>
</resources>

Thanks for the help

Upvotes: 0

Views: 3443

Answers (1)

adamp
adamp

Reputation: 28932

If you're setting this as a window background you don't need to set it as a background for your layout too. (No reason to have the system draw it twice - it will be slower.)

Have you set your custom theme as your Activity's theme in your manifest?

Upvotes: 1

Related Questions