I've done some searching, but I haven't been able to find a similar enough question to what I'm trying to do. Maybe you guys can help me find a good reference or simply help me reach a solution.
From the title you know that I'm trying to use Universal Image Loader v1.8.5 and the Android version I'm working on is v4.0 min sdk v14.
I have ImageViews
which have a fixed height. The ScaleType
is set to centerCrop
. So what ends up happening is the following:
Actual
What I want to happen is the following where only the section filled in Blue is displayed:
Desired
How can I get only the top half of a particular image to display? I hesitate to alter the default code in the library since I don't what this to happen for every image which is loaded using the UIL.
Edit For clarification, I'm passing an URL and the destination ImageView to the ImageLoader.displayImage method. So I don't really know what dimensions I'm gonna get for the image which is downloaded.
I think what you looking for is already in a small easy to use lib called AQuery
https://code.google.com/p/android-query/
you can download an app that have all the functions for this lib at the market
AndroidQuery
you will need to use Aspect Ratio with Anchor
and set ratio
& anchor
to 1 which mean to crop the rest of the bitmap from bottom and show the top of the bitmap.