Skip to content Skip to sidebar Skip to footer

Scale Images Inside Textview Using Imagegetter

I'm trying to scale the images showed in the textview but i just can't. I'm using this code but no matter what, it shows the image cropped inside the container or doesn't show at a

Solution 1:

I answer myself i've changed

 if (originalWidthScaled > metrics.widthPixels) {
                height = result.getIntrinsicHeight() * metrics.widthPixels
                        / result.getIntrinsicWidth();
                width = metrics.widthPixels;
            }

for

if (originalWidthScaled > (metrics.widthPixels * 70) / 100) {
                width = (metrics.widthPixels * 70) / 100;

                height = result.getIntrinsicHeight() * width
                        / result.getIntrinsicWidth();
            }

And now it occupies the 70% of the space of the screen which is exactly the max size of the container

Post a Comment for "Scale Images Inside Textview Using Imagegetter"