Frage

I want to fit image to android imageview without preserving the aspect ratio. I.e. I want the image to resize to imageview's size. I know that I can use the image as a background of the imageview to achieve the purpose. But is there any way I can use it as a foreground image of the imageview and fitting it to its dimension?

I have seen various answers and all of them suggest the other thing(image view fitting to the image size).I want to do it via xml.

War es hilfreich?

Lösung

Of course, you have tried

android:scaleType="fitXY"

I suppose...

Developer - Scale Type

This would scale in both directions (X, Y) independently (by using the FILL algorhithm, which is - more or less, the same as what it does when setting a background).

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top