athos
09/14/2021, 9:31 AM<shape xmlns:android="<http://schemas.android.com/apk/res/android>"
android:shape="oval">
<stroke
android:width="1dp"
android:color="#555555" />
<gradient android:type="radial"
android:centerX="0.42"
android:centerY="0.4"
android:gradientRadius="100%"
android:startColor="#111111"
android:centerColor="#111111"
android:endColor="#444444" />
</shape>
val thumb = painterResource(id = R.drawable.metro_wheel_thumb)
and
val thumb = rememberVectorPainter( ImageVector.vectorResource(R.drawable.metro_wheel_thumb)
)
and drawing with:
with(thumb) {
draw(Size(THUMB_SIZE.toPx(),THUMB_SIZE.toPx()))
}
in the canvas, but I get exception because a VectorDrawable is expectedval ctx = LocalContext.current
val drawable = ContextCompat.getDrawable(ctx, R.drawable.metro_wheel_thumb)
and
drawable?.let {
drawImage(
it.toBitmap(
width = THUMB_SIZE.roundToPx(),
height = THUMB_SIZE.roundToPx()
).asImageBitmap(),
)
}
But I wonder if there's a more appropriate wayZach Klippenstein (he/him) [MOD]
09/14/2021, 2:32 PM