'Android jetpack compose - Drawable colors

I am having the following issue. I am adding some vector drawable images in my project which is built using Jetpack compose. I am overriding the colors of the drawable by setting

android:fillColor="?colorPrimary"

But, the previous solution, even though it works on a usual Android project, when working on Jetpack compose it is not.

Of course, I have initialized a Material Theme with my colors/typo/shapes.

Any suggetions?

Best regards!



Solution 1:[1]

I've run into similar issues where compose doesn't play well with attributes. It prefers to access via colorResource(R.color.colorName).

What you might be looking for is either of the below implementations:

Icon(
 Icons.Filled, 
 "contentDescription",
 tint = MaterialTheme.colors.secondary
)

Image(
    painter = painterResource(R.drawable.resourceName), 
    contentDescription = "contentDescription", 
    colorFilter = ColorFilter.tint(Color.myColor)
)

Solution 2:[2]

You can try cumsum then pass to factorize

s = df.Value.ne(0)

df.loc[df.index[~s],'new'] = s.cumsum()[~s].factorize()[0]+1

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jüri Kiin
Solution 2 BENY