2012-03-13 131 views
3

每一個Android應用程序/主題事呢它自己的基本主題顏色:更改基本主題顏色的Android應用程序的

HTC Desire Z的 - 綠色,

大部分三星deviced - 黃色,...

這是所選列表項目的顏色,選項菜單 - 單選按鈕,單選按鈕,進度條,....

我知道如何改變這些顏色個人。但是有沒有辦法通過設置一個值來改變它們?

喜歡的東西:

<style name="my_theme" parent="@android:style/Theme.Black"> 
     <item name="android:_DEFAULT_BASE_COLOR_1">#XXXXXX</item> 
</style> 

//編輯:只有一個項目

所以我在尋找_DEFAULT_BASE_COLOR_1,在那裏我可以設置單選按鈕顏色的關鍵字,slected列表項。可能嗎?

回答

-1

application標記您的清單定義爲:

android:theme="@style/mytheme" 

現在在res /值,你可以定義一個文件說theme.xml的內容爲:

<resources> 
    <style name="mytheme" parent="@android:style/Theme" > 
     <item name="android:_DEFAULT_BASE_COLOR_1">#XXXXXX</item> 
     <item name="android:windowNoTitle">true</item> 
     ... . 
    </style> 
</resources> 
+0

這就是我已經有的:)我正在尋找正確的關鍵字'_DEFAULT_BASE_COLOR_1' – 2012-03-13 17:38:05

+0

所有這些基因集會有9個補丁的圖像,而不是顏色定義。對於例如聚焦的編輯文本,您會在各種設備中看到橙/藍色..不是顏色,但都是可繪製的....您必須修改它們中的每一個,例如編輯文本' ___ mystyle___' – 2012-03-14 04:40:36

+0

請將您的評論」您將不得不修改其中的每一個「,因爲即使在」標準主題「中也有不同的可繪製,因此無法一次覆蓋」默認「可繪製。 – 2012-03-14 04:53:33

0

試試這個:

<style name="my_theme" parent="@android:style/Theme.Black"> 
     <item name="listChoiceIndicatorSingle">xxxxxxx</item> 
<item name="radioButtonStyle">xxxxxxx</item> 
<item name="listChoiceBackgroundIndicator">xxxxxxx</item> 
<item name="listViewStyle">xxxxxxx</item> 
<item name="listDivider">xxxxxxx</item> 
<item name="listSeparatorTextViewStyle">xxxxxxx</item> 
    .... 
    </style> 
+0

好吧,這就是我想要避免的(設置所有樣式手冊)。除此之外,風格不採取listViewStyle和radioButtonStyle :) – 2012-03-13 18:30:46

相關問題