2013-03-04 79 views
3

我試圖做主題,我問自己,是否有可能爲特定的textview提供不同的顏色。安卓主題顏色

例如:在「Theme.One」中,我將在文本視圖「標題」中使用顏色綠色和textview「text1」顏色粉紅色。

的themes.xml

<style name="Theme.One" parent="@android:style/Theme.Light"> 
     <item name="android:background">@color/Azur</item> 
     <item name="android:textColor">@color/Black</item> 
     ... 
     </style> 
     <style name="Theme.Two" parent="@android:style/Theme.Light"> 
     <item name="android:background">@color/Blue</item> 
     <item name="android:textColor">@color/White</item> 
     ... 
     </style> 

Interface.xml

<TextView 
     android:text="@string/Title" 
     android:id="@+id/Title" 
     android:textSize="25sp" /> 
    <TextView 
     android:text="@string/text1" 
     android:id="@+id/text1" 
     android:textSize="20sp" /> 

我希望能有很好制定的句子,請多多關照了答案,

阿齊扎

回答

0

在清單:

android:theme="@style/myTheme" 

在res /值文件夾:

<style parent="@android:style/Theme.Dialog" name="myTheme"> 
    <item name="android:textColor">#00ff00</item> 
    <item name="android:dateTextAppearance">?android:attr/textAppearanceSmall</item> 
</style> 

你可以c將顏色ti變成不同的顏色並將其應用於textview的顏色。

android:textColor="yourcolor" 
0

粉紅色應該有一種風格,綠色應該有另一種風格。例如 爲綠色的TextView:

<TextView 
    android:text="@string/Title" 
    android:id="@+id/Title" 
    android:textSize="25sp" 
    style="@style/Colorgreen" 
/> 

和風格你有

<style name="Colorgreen"> 
     <item name="android:textColor">#00FF00</item> 
     </style>