2013-03-04 106 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>