Ich versuche Android Themen zu lernen und in Schwierigkeiten geriet die Einrichtung eines TextView
Textfarbe auf eine andere Farbe dann diese globale einzustellen:Wie Textview Textfarbe zu bestimmten Themen Farbe
<item name="android:textColor">@color/white</item>
Ich habe diese:
<item name="chatBubbleTextColor">@color/material_bohemia_500</item>
und dachten, dass ich es in der Textview xml wie
android:textColor="?attr/chatBubbleTextColor"
verwenden könnte, aber ich kann mir nicht bekommen t Arbeitet es vielleicht nicht so?
Ich weiß, dass ich so tun kann:
<style name="BohemiachatBubbleTextColor" parent="android:Theme">
<item name="android:textColor">@color/material_bohemia_500</item>
</style>
Aber wie das was ich tun muss, um wirklich? Ich möchte nur eine Farbe erzeugen Attribut keinen neuen Stil
Hier ist das Thema zu schaffen, es ist zwei Themen und die chatBubbleTextColor
unterscheidet sich sowohl für
Bohemia App Theme und Red App Theme
<!-- Base Theme -->
<style name="BaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Attributes for all APIs -->
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="dialogTheme">@style/AppTheme.Dialog</item>
<item name="alertDialogTheme">@style/AppTheme.Dialog.Alert</item>
<item name="colorControlHighlight">@color/selector_black_pressed</item>
<!-- Theme for the Preferences -->
<item name="preferenceTheme">@style/AppPreferenceTheme</item>
<!-- Theme for the pacv_placesAutoCompleteTextV -->
<item name="pacv_placesAutoCompleteTextViewStyle">@style/Widget.AppCompat.EditText</item>
<!-- Default App Theme -->
<style name="AppTheme" parent="BaseTheme">
<!-- API specific attributes 14+ -->
<item name="selectableRectDrawable">@drawable/state_list_selectable_rect_black</item>
<item name="selectableRectDrawableInverse">@drawable/state_list_selectable_rect_white</item>
<item name="selectableRectDrawableColored">@drawable/state_list_selectable_rect_black</item>
<item name="selectableRoundedRectDrawable">@drawable/state_list_selectable_rounded_rect_black</item>
<item name="selectableRoundedRectDrawableInverse">@drawable/state_list_selectable_rounded_rect_white</item>
<item name="selectableRoundedRectDrawableColored">@drawable/state_list_selectable_rounded_rect_black</item>
</style>
<!-- Bohemia App Theme -->
<style name="BaseTheme.Bohemia" parent="AppTheme">
<!-- Attributes for all APIs -->
<item name="colorPrimary">@color/material_bohemia_400</item>
<item name="colorPrimaryDark">@color/material_bohemia_500</item>
<item name="colorAccent">@color/material_bohemia_a100</item>
<item name="dialogTheme">@style/AppTheme.Dialog.Bohemia</item>
<item name="alertDialogTheme">@style/AppTheme.Dialog.Alert.Bohemia</item>
<item name="android:windowBackground">@color/material_bohemia_600</item>
<!-- Sets the color of the control when it is not activated like an unchecked checkbox. -->
<item name="colorControlNormal">@color/material_bohemia_a200</item>
<!-- Chat bubble -->
<item name="chatBubbleTextColor">@color/material_bohemia_500</item>
</style>
<style name="AppTheme.Bohemia" parent="BaseTheme.Bohemia">
<!-- API specific attributes 14+ -->
<item name="selectableRectDrawableColored">@drawable/state_list_selectable_rect_bohemia</item>
<item name="selectableRoundedRectDrawableColored">@drawable/state_list_selectable_rounded_rect_bohemia</item>
<!-- Add your custom overall styles here -->
</style>
<!-- Red App Theme -->
<style name="BaseTheme.Red" parent="AppTheme">
<!-- Attributes for all APIs -->
<item name="colorPrimary">@color/material_red_500</item>
<item name="colorPrimaryDark">@color/material_red_700</item>
<item name="colorAccent">@color/material_red_a700</item>
<item name="dialogTheme">@style/AppTheme.Dialog.Red</item>
<item name="alertDialogTheme">@style/AppTheme.Dialog.Alert.Red</item>
<item name="android:windowBackground">@color/material_red_300</item>
<!-- Chat bubble -->
<item name="chatBubbleTextColor">@color/material_red_500</item>
</style>
<style name="AppTheme.Red" parent="BaseTheme.Red">
<!-- API specific attributes 14+ -->
<item name="selectableRectDrawableColored">@drawable/state_list_selectable_rect_red</item>
<item name="selectableRoundedRectDrawableColored">@drawable/state_list_selectable_rounded_rect_red</item>
<!-- Add your custom overall styles here -->
</style>
sollte es sein 'android: textcolor = "@ color/chatBubbleTextColor"' – Pztar
Mögliche Duplikat [Android, wie man Farbe Design-Schriftart für nur Textview Widgets?] (Http://stackoverflow.com/questions/15960029/android-how-to-theme-font-farbe-for-just-textview-widgets) –