Closed JKorsten closed 3 years ago
Hi.
Perhaps one of these FAQ solutions might solve your problem?
If not, then I may have to see the SVG that is not working. And also more detail about your layout (eg the XML/Compose code).
Yes this works, I had to add 100% for width and height Only issue I have now is that is has sort of a margin/padding all around the view, but when I add an image via setImageResource it doesn't have the margin/padding
I'll try some more things, else I'm going to create a demo project which I'm going to add
Fixed it:
val svg: SVG = SVG.getFromAsset(assets, "svgFile.svg")
val bitmap = Bitmap.createBitmap(3840, 2180, Bitmap.Config.ARGB_8888)
val canvas = Canvas(bitmap)
svg.renderToCanvas(canvas)
imageView.setImageBitmap(bitmap)
this works, when using the renderToDrawable it adds padding, this way it doesn't
Hey,
I'm using your library and like it, but I'm having an issue. I have a SVG which is 3840*2180 and my image view is full screen (on a 4k screen) when I load the SVG using
val svg: SVG = SVG.getFromAsset(assets, "svgFile.svg") val drawable: Drawable = PictureDrawable(svg.renderToPicture()) imageView.setImageDrawable(drawable)
The image displays centered in the screen and it seems like it is displayed in a square.
I use the same code on a view which is 90*90 with a smaller svg but this works.
Do I need to set some other values to make the image full screen?