Search code examples
androiduniversal-image-loader

Android ImageLoader resize


I'm using ImageLoader (for the first time) to show image on my app. I show images with this :

 ImageLoader.getInstance().displayImage("http://www.web.com/pic_1.jpg", picture);

But picture is a imageview with width 200dp and height 100dp. How can i make the picture to fit in that resolution? whatever the picture is portrait or landscape.

Please help!


Solution

  • Use FrameLayout for your ImageView layout similar like:

    <FrameLayout
        android:id="@+id/image"
        android:layout_width="200dp"
        android:layout_height="100dp">
    
        <ImageView
            android:id="@+id/picture"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:adjustViewBounds="true"
            android:layout_gravity="center"
            android:gravity="center" />
    </FrameLayout>