Gradient with color selector attribute

Viewed 63

I'm trying to build a shape gradient using color selector with attributes instead of plain color references.

So the gradient changes when theme changes, dark mode, etc...

Works

    <gradient
        android:angle="90"
        android:endColor="?colorOnSurface"
        android:startColor="@android:color/transparent"
        />

Gradients that references attributes not work as expected: (colorOnSurface is black)

    <gradient
        android:angle="90"
        android:endColor="@color/color_on_surface_no_alpha"
        android:startColor="@android:color/transparent" />
    <gradient
        android:angle="90"
        android:endColor="@color/color_on_surface_38"
        android:startColor="@android:color/transparent" />

gradient on API 29

Does anyone know if it's possible to have gradients using color selectors that references attributes?

0 Answers
Related