2012-10-03 33 views
1

列在我的清單中的應用程序的主題點的系統主題在styles.xml文件中列出的機器人風格:Android清單不承認styles.xml

<manifest 
xmlns:android="http://schemas.android.com/apk/res/android" 
package="test.theme" 
android:versionCode="1" 
android:versionName="1.0" > 

<uses-sdk 
    android:minSdkVersion="16" 
    android:targetSdkVersion="15" /> 

<application 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name=".MainActivity" 
     android:label="@string/title_activity_main" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
</application> 

styles.xml :

<resources> 
    <style name="AppTheme" parent="android:Theme.Black" /> 
</resources> 

但由於某些原因主題不被識別,而是加載白色主題。然而,它的功能,當我把主題直接進入清單這樣的預期:

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

即使在同樣的問題出現一個空的默認項目。 AppTheme的值在R.java中列出,所以文件被識別爲OK。有沒有人有任何其他想法可能是什麼問題?

+0

你有沒有嘗試過,在你的styles.xml中,做父=「@ android:style/Theme.Black」而不是你現在擁有的? – dennisdrew

+0

是的,我剛剛嘗試過,但它沒有任何區別。 – Spoonface

+0

也許你的答案就在這個其他線程: http://stackoverflow.com/questions/11779679/setting-android-theme-background-color –

回答

2

我確實最終解決了這個問題,最後這是一個非常簡單的問題。

有一個特定於平臺的values-v14/styles.xml文件,我應該放入我的樣式,因爲此表中的默認值優先於我對全局值/ styles.xml進行的更改文件。

因此,如果有人在這裏遇到同樣的問題,您可能需要檢查是否保存在目標平臺的正確styles.xml文件中。