Android 将背景图像设置为已具有主题的应用程序
嗨,我想设置背景图像,我的应用程序已经有一个主题Android 将背景图像设置为已具有主题的应用程序,android,background-image,android-theme,Android,Background Image,Android Theme,嗨,我想设置背景图像,我的应用程序已经有一个主题 <application android:theme="@android:style/Theme.NoTitleBar" /> 现在我把代码改成了这个 <style name="BackgroundImage" parent="@android:style/Theme.NoTitleBar"> <item name="android:background">@drawable/backgr
<application android:theme="@android:style/Theme.NoTitleBar" />
现在我把代码改成了这个
<style name="BackgroundImage" parent="@android:style/Theme.NoTitleBar">
<item name="android:background">@drawable/background</item>
</style>
@可绘制/背景
清单文件如下所示
<application android:theme="@style/BackgroundImage" />
现在背景图像已设置,但我以前的主题(即theme.NoTitleBar)不起作用
理想的行为应该是背景图像和主题。NoTitleBar应该可以工作。我应该怎么做?您需要在xml文件中执行,而不是在清单中执行 你只需要做这样的事情:
<?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
//你的可画图像在这里
希望我能帮助你我改变了风格如下,通过这样做,我超越了主题。NoTitlteBar
<style name="Background" parent="@android:style/Theme.NoTitleBar">
<item name="android:windowBackground">@android:color/black</item>
<item name="android:windowNoTitle">true</item>
</style>
@android:彩色/黑色
真的
现在清单文件如下所示
<application android:theme="@style/Background"/>
我想说父定义可能不正确(@android:style/Theme.NoTitleBar可能不正确?)不,这不是问题所在。不管怎样,我已经做了你提到的和检查过的更改,但是不起作用。谢谢你的回复。我以后会尝试这种方法,但我发现了我的错误,我现在将发布我的解决方案。