I have an app with several skins. In one skin i define android:colorBackground
and then I want to set this color in an XML layout as ViewGroup background color. How do I do it? Is it possible? Or it is some attribute used by the system only?
<style name="SkinDefault" parent="@style/_SkinXYZ">
<item name="android:colorBackground">@color/skin_default_color_background</item>
<item name="colorOnBackground">@color/skin_default_color_on_background</item>
</style>
colorPrimary and colorSecondary represent the colors of your brand. colorPrimaryVariant and colorSecondaryVariant are lighter or darker shades of your brand colors. colorSurface is used for “sheets” of material (like cards and bottom sheets) android:colorBackground is the window background color of your app.
The Attr interface represents an attribute in an Element object. Typically the allowable values for the attribute are defined in a schema associated with the document.
The primary color is the color displayed most frequently across your app's screens and components. The primary variant color is used to distinguish two elements of the app using the primary color, such as the top app bar and the system bar. The secondary color provides more ways to accent and distinguish your product.
Ran into this problem myself, colorOnBackground
and the other Material Components colors can be referenced with ?attr/colorOnBackground
.
But in order to reference android:colorBackground
you will have to preface with android like this ?android:attr/colorBackground
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