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

allan.conda

06/09/2020, 11:38 PM
any way to load a non-vector drawable xml into an ImageAsset?
trying to load but imageResource returns me null exception
v

Val Salamakha

06/10/2020, 12:26 AM
Copy code
Image(
    asset = vectorResource(R.drawable.ripple),
    colorFilter = ColorFilter.tint(MaterialTheme.colors.primary)
)
a

allan.conda

06/10/2020, 12:39 AM
same version as you, I get:
Copy code
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #2<VectorGraphic> tag requires viewportWidth > 0
and that should fail anyway, since this is not a vector; so it’s strange that it works for you 🤔 this is a runtime error btw
v

Val Salamakha

06/10/2020, 1:22 AM
You are right.
t

Timo Drick

06/10/2020, 9:13 AM
Maybe better use a Modifier.ripple(..)?
🤔 1
a

allan.conda

06/10/2020, 9:14 AM
I see. Although my main motivation is to have a custom circular shape drawable to act as a camera button
t

Timo Drick

06/10/2020, 9:14 AM
I know is not really a solution for all things. But many of the drawble shapes are available as modifieres
a

allan.conda

06/10/2020, 9:15 AM
I see, interesting. Let me have a look at these
t

Timo Drick

06/10/2020, 9:15 AM
For me one of the best things of Compose is to get rid of XML config files 😄
a

allan.conda

06/10/2020, 9:23 AM
Agree. Then they’re probably working to get rid of these XMLs that’s why the api for it doesn’t exist
29 Views