在android中将背景图像设置为整个应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12721592/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 11:32:02  来源:igfitidea点击:

set background Image to whole application in android

androidbackground-imageandroid-theme

提问by sundeep

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

我想在 android 中为我的应用程序设置背景图像。所以我的应用程序已经在我的清单文件中设置了一个像这样的主题

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

Now this was implemented from the themes of android package.

现在这是从android包的主题实现的。

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.

我也想要 Theme.NoTitleBar。

采纳答案by sundeep

I have changed the style below, by doing this I am overriding the Theme.NoTitlteBar

我改变了下面的样式,通过这样做我覆盖了 Theme.NoTilteBar

<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"/>

回答by Rajeev N B

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

您必须使用样式来实现此目的查看此链接

Create a theme with your background and use that theme.

使用您的背景创建一个主题并使用该主题。