https://kotlinlang.org logo
#compose
Title
# compose
m

myanmarking

09/24/2021, 4:48 PM
previously, we could have vector drawables with theme colors, ex:
Copy code
<vector xmlns:android="<http://schemas.android.com/apk/res/android>"
    android:width="184dp"
    android:height="184dp"
    android:viewportWidth="184"
    android:viewportHeight="184">
    <path
        android:fillColor="?attr/colorPrimary"
        android:fillType="evenOdd"
        android:pathData="M22 92a70 70 0 1 1 140 0 70 70 0 1 1-140 0" />
is there any recommended path for compose ?
a

alorma

09/24/2021, 5:03 PM
Use
tint
attribute of
Icon
m

myanmarking

09/24/2021, 5:03 PM
ya, doesn’t really work. Only parts of the vector are colored dynamically based on theme primary color
p

Peter Mandeljc

09/24/2021, 7:06 PM
Currently, I think, the best approach is still to continue defining theme and colors in xml and reference xml colors from compose. Otherwise your theme will be different until activity boots up. Taking that into account, basically nothing changed in your case :)
m

myanmarking

09/27/2021, 1:11 PM
ya kinda. but if you have single app multi fragment approach, and you have different themes for each feature, you would have to define the theme in xml parent. OR just use wrapperLayoutInflator or sth with new theme for the fragment. But since compose get’s rid of all of that. hm … idk. Maybe use LayoutInflator theme wrapper for ComposeView ?
2 Views