ImageView: scale images too large down, do not scale images too small

I think the name already says what I want to do:

I have ImageViewwhen the image to display was downloaded from the Internet ( UIL ) I want

and. reduce the image to size ImageViewif the image is larger thanImageView

b. Do not scale the image, but display the original size in it when the image is smaller thanImageView

Bot is not a problem with

android:scaleType="fitCenter"

for a. and

android:scaleType="center"

for b.

Is it possible to combine these two? Will my only option be "manually" to compare the size of the ImageView and the size of the loaded BitMap with each other and set accordingly scaleType?

EDIT: This is my UIL configuration:

public static final DisplayImageOptions uiloptions = new DisplayImageOptions.Builder()
        .resetViewBeforeLoading(true)
        .bitmapConfig(Bitmap.Config.RGB_565)
        .imageScaleType(ImageScaleType.IN_SAMPLE_INT)
        .cacheInMemory(true)
        .cacheOnDisk(true)
        .build();

imageLoaderConfiguration = new ImageLoaderConfiguration.Builder(this)
        .threadPoolSize(2)
        .defaultDisplayImageOptions(Values.uiloptions).build();
+4
1

:

android:scaleType="centerInside" 

0

All Articles