Android - 使用styles.xml的应用程序背景

时间:2012-11-02 11:45:43

标签: android android-layout

我正在尝试使用以下代码

在styles.xml中全局设置背景

styles.xml

<resources xmlns:android="http://schemas.android.com/apk/res/android">
  <style name="AppTheme" parent="android:Theme.Light" >      
    <item name="android:background">@drawable/background</item>      
  </style>
</resources>

我还在AndroidManifest.xml文件中添加了它

<application android:label="@string/app_name"
    android:icon="@drawable/ic_launcher"
    android:theme="@style/AppTheme">

....
</application>

但是图像没有显示出来。我在所有可绘制的文件夹中都有图像。

1 个答案:

答案 0 :(得分:1)

试试这个。

<style name="Theme" parent="@android:style/Theme">
    <item name="android:windowBackground">@drawable/background</item>
</style>