2010-11-18 34 views

回答

4

在包含该样式的值目录中创建一个XML文件。这可能是这样的:

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <style name="YourTheme" parent="@android:style/Theme"> 
     <item name="android:windowBackground">@drawable/your_background</item> 
    </style> 
</resources> 

对于上述工作的情况下,你需要有一个图像中绘制文件夹名为your_background.png。然后,您可以通过在manifest文件这样做套用样式要么你的整个应用程序或一个特定的活动:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
     package="bla.bla"> 
    <application android:theme="@style/YourTheme"> <!-- This is for the whole app --> 

     <activity android:name="bla.bla.YourActivity" 
        android:theme="@style/SplashTheme"/><!-- This is for a specific activity --> 

    </application> 
</manifest> 
+0

您好Cristian在xml文件中第4行的编译错误.saying @drawable没有正确拼写。 – manju 2010-11-20 06:05:13

+0

我正在等待您的回复..提前感谢... – manju 2010-11-20 06:20:41

0

你可能会使用一些UI布局XML。将布局(线性,相对等)背景设置为您想要设置背景的任何图像。确保图像在res/drawable文件夹中可用。

+0

您能否给出代码... – manju 2010-11-20 06:05:55