Android SVG with Aspect ratio, Alignment, and Scale #1057
DavidCorrado
started this conversation in
General
Replies: 1 comment
-
Looking to get the glide and the coil image here to look the same if you want an example |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am exploring changing from Glide SVG library to coil
https://github.com/BigBadaboom/androidsvg
So I am trying to translate some of the Aspect Ratio, Alignment, Scale rules to coil like in this file
https://github.com/BigBadaboom/androidsvg/blob/master/androidsvg/src/main/java/com/caverock/androidsvg/PreserveAspectRatio.java
So I want to do some things like Fill Height/ Fill Width and then allow alignment with top left, bottom left, center left, ... etc
From my understanding coil uses scaleType and adjustViewBounds like documented here
https://thoughtbot.com/blog/android-imageview-scaletype-a-visual-guide
Also coil has scale(Scale.FILL)
But from my understanding that is not as flexible as the above library.
To give you a concrete example I am looking for:
I want to have an SVG fit height and align top left. Which means that if the image is tall that it would grow the width until it matches the height its trying to fit in but maintain aspect ratio and crop extra but top left will always be visible.
Also similar thing for fit height and align bottom left.
Is this type of flexibility built into coil?
Beta Was this translation helpful? Give feedback.
All reactions