obtain Tinted Styled Attributes
Safely retrieve styled attribute information in this Context's theme using , after checking whether the theme is compatible with the component's given style.
Set a component's enforceMaterialTheme
attribute to true
to ensure that the Context's theme inherits from Theme.MaterialComponents
. For example, you'll want to do this if the component uses a new attribute defined in Theme.MaterialComponents
like colorSecondary
.
New components should prefer to use obtainStyledAttributes, and use as a replacement for the functionality in androidx.appcompat.widget.TintTypedArray.
If the enforceTextAppearance
attribute is set to true
and textAppearanceResIndices parameter is specified and has non-negative values, this will also check that a valid TextAppearance is set on this component for the text appearance resources passed in.