sundeep
sundeep

Reputation: 601

Setting background image to an application which already has a theme

Hi i want to set background image to my application which already has a theme.

<application   android:theme="@android:style/Theme.NoTitleBar" />

Now i have changed the code to this

  <style name="BackgroundImage" parent="@android:style/Theme.NoTitleBar">
    <item name="android:background">@drawable/background</item>
</style>

the manifest file looks like this

 <application   android:theme="@style/BackgroundImage" />

Now the background image is set but my previous theme i.e. Theme.NoTitleBar is not working.

Ideal behavior expected is both background image and Theme.NoTitleBar should be working. What should i do?

Upvotes: 0

Views: 6067

Answers (2)

sundeep
sundeep

Reputation: 601

I have changed the style as follows by doing this i am overriding the Theme.NoTitlteBar

 <style name="Background" parent="@android:style/Theme.NoTitleBar">
    <item name="android:windowBackground">@android:color/black</item>
    <item name="android:windowNoTitle">true</item>
</style>

Now manifest file looks like this.

<application  android:theme="@style/Background"/>

Upvotes: 1

Pieter Tielemans
Pieter Tielemans

Reputation: 624

you need to do it in the xml file, and not your manifest.

you just have to do somerhing like this:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"

android:background="@drawable/yourimage" >   //your drawable image here

hope i helped you

Upvotes: 0

Related Questions