Created
July 31, 2020 09:14
-
-
Save ricknout/6ee5d39988b6261a238e447fca120b2d to your computer and use it in GitHub Desktop.
MDC-Android color in custom views
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Copyright 2020 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 --> | |
<!-- In res/values/attrs.xml --> | |
<declare-styleable name="AppCustomView"> | |
<attr name="backgroundTint" /> | |
<attr name="titleTextColor" /> | |
... | |
</declare-styleable> | |
<!-- In res/values/styles.xml --> | |
<style name="Widget.App.CustomView" parent="android:Widget"> | |
<item name="backgroundTint">?attr/colorSurface</item> | |
<item name="titleTextColor"> | |
@color/material_on_surface_emphasis_high_type | |
</item> | |
... | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment