set background Image to whole application in android

余生颓废 提交于 2019-12-04 03:15:45

问题


I want to set background image to my application in android. So my application already has a theme set in my manifest file like this

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

Now this was implemented from the themes of android package.

Now i want to add a background image to my entire application how can i do it.

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

I want the Theme.NoTitleBar as well.


回答1:


You have to use styles to achieve this Check out this link

Create a theme with your background and use that theme.




回答2:


I have changed the style below, 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 my manifest file looks like this:

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


来源:https://stackoverflow.com/questions/12721592/set-background-image-to-whole-application-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!