loopj / android-smart-image-view

Android ImageView replacement which allows image loading from URLs or contact address book, with caching
http://loopj.com/android-smart-image-view/
1.3k stars 510 forks source link

How to set a progressloader for Images in ListView #48

Open protocol10 opened 9 years ago

protocol10 commented 9 years ago

I am trying to load images using URL in Listview and I am able to show a progressbar widget while loading the images.

But the problem is, the image is not displayed for the first list item even if it gets loaded in Background. i.e onCompletionListener for that item gets executed properly, but the images is not displayed.

If I scroll the list down and comeback upwards the image is displayed.

Is there any other way to show progress while loading Images in ListView or any general view.

This is my layout <FrameLayout android:id="@+id/layout_img" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" >

    <com.loopj.android.image.SmartImageView
        android:id="@+id/img_view
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:adjustViewBounds="true"
        android:contentDescription="@string/description_img"
        android:scaleType="centerCrop"
        android:src="@drawable/room"
        android:visibility="invisible" />

    <ProgressBar
        android:id="@+id/img_loader"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center" />
</FrameLayout>