Rosen Dimov
10/31/2020, 7:35 PM<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="<http://schemas.android.com/apk/res/android>"
android:shape="rectangle">
<solid android:color="#bfbfbf" />
</shape>
in an Image
composable like this,
Image(asset = vectorResource(id = R.drawable.img_placeholder))
I get
Binary XML file line #3<VectorGraphic> tag requires viewportWidth > 0
I tried:
• setting modifier = Modifier.fillMaxWidth()
on the Image
composable and on a wrapper Column
as well
• adding <size android:width="10dp" android:height="10dp" />
in the drawable's xml
But this didn't help. Without composables, I was using the above-mentioned drawable as a placeholder parameter to Glide, like this:
val drawable = ContextCompat.getDrawable(context, R.drawable.img_placeholder)!! as GradientDrawable
...
Glide.with(context)
.load(imageUrl)
.placeholder(drawable)
Is it necessary to use <vector>
? (<shape>
can't be direct child of it) Or maybe I need to create proramatically a bitmap (in this case it's simple enough to do so, but it's just an example)?
Note that other vector drawables, based on <vector>
work fine (probably because they have viewportWidth
and viewportHeight
attrs set). Thank you!