【问题标题】:set background Image to whole application in android在android中将背景图像设置为整个应用程序
【发布时间】:2012-10-04 06:37:06
【问题描述】:

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

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

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

现在我想为我的整个应用程序添加背景图片,我该怎么做。

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

我也想要 Theme.NoTitleBar。

【问题讨论】:

  • 如果你在drawable文件夹中有你的图片资源,你可以按如下方式引用它们:android:background="@drawable/resource_name"。
  • 我试过了,还是不行。

标签: android background-image android-theme


【解决方案1】:

我改变了下面的样式,通过这样做我覆盖了 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>

现在我的清单文件如下所示:

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

【讨论】:

    【解决方案2】:

    你必须使用样式来实现这一点 看看这个link

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

    【讨论】:

    • 我试过这个解决方案,但是按照这个方法会删除必须应用的 Theme.NoTitleBar,我必须添加同时应用 Theme.NoTitleBar 的背景图像。
    猜你喜欢
    • 2011-06-22
    • 1970-01-01
    • 1970-01-01
    • 2019-07-11
    • 1970-01-01
    • 2021-01-20
    • 1970-01-01
    • 1970-01-01
    • 2013-12-18
    相关资源
    最近更新 更多