2011-04-12 64 views

回答

8

看看Apply a theme to an Activity or application在整个应用程序中应用背景图像。

+1

谢谢!所以,基本上,我定义了一个带有背景图像的样式,然后在Manifest中,我将“android:theme”标签与我的样式相结合,这就是全部? – lomza 2011-04-12 09:25:49

+0

我还没有尝试它的背景图像的情况下,但是,这是你需要采取的方向。 – rajath 2011-04-12 09:27:38

+0

它的工作原理!尽管如此,我还有其他问题,比如在一个活动/应用程序中实现少量主题,但希望我能处理它。 – lomza 2011-04-12 10:18:24

0

添加android:windowBackground你的主题:

<!-- Base application theme. --> 
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <!-- Customize your theme here. --> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
    <item name="android:windowBackground">@color/colorPrimaryDark</item> 
</style> 

过程,并确保您的清单采用了主题为您的应用程序:

<?xml version="1.0" encoding="utf-8"?> 
<manifest package="com.package.name" 
      xmlns:android="http://schemas.android.com/apk/res/android"> 

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

     <activity android:name=".MainActivity"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN"/> 
       <category android:name="android.intent.category.LAUNCHER"/> 
      </intent-filter> 
     </activity> 

    </application> 

</manifest> 
相关问题