Android AnimationDrawable Scaling

I have an ImageView that initially has a bitmap:

<ImageView android:layout_width="fill_parent" android:layout_height="wrap_content" /> 

By default, this image view scales the bitmap to fill the width I need.

But the problem is that when I change the source code of ImageView to AnimationDrawable, which is created by several images of the same size of the original, then the animation does not scale at all and returns to the original.

How can I make the animation scale in the same way that a bitmap is scaled?

+4
source share
1 answer

I did this programmatically using ImageView setPadding (). I calculated the difference between the height and width of the ImageView and what I wanted to display, and installed my own add-on so that the useful size of the ImageView would fit my animation exactly.

This is brute force and not very flexible, but I have not seen a better solution, and this problem has arisen many times.

+3
source

All Articles