While looking through the built in Android themes/styles I noticed references to textColorPrimary, textColorSecondary etc. I would like to implement this in to my own theme but cannot find any way of setting a textview (or any view) to "primary" or "secondary" etc.
Am I overlooking something or is it not possible to be done?
TextAppearance allows you to define text-specific styling while leaving a View 's style available for other uses. Note, however, that if you define any text attributes directly on the View or in a style, those values would override the TextAppearance values.
Settings. Under Display Options, tap Theme. Select the theme for this device: Light—White background with dark text.
xml in the your application's res/values directory. Add a root <resources> node. For each style or theme, add a <style> element with a unique name and, optionally, a parent attribute. The name is used for referencing these styles later, and the parent indicates what style resource to inherit from.
Android TextView – Text Color. TextView Text Color – To change the color of text in TextView, you can set the color in layout XML file using textColor attribute or change the color dynamically in Kotlin file using setTextColor() method.
The references you're seeing to "textColor_____" are references to color selectors. You use them with a line like 'android:textColor="?android:textColorSecondary"' in the xml definition of your TextView.
See this for more detail: http://developer.android.com/guide/topics/resources/accessing-resources.html#ReferencesToThemeAttributes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With