2011-04-12 66 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> 
相關問題