-1

I have a list in which I am displaying text then image and 4 options (A, B ,C , D)

I am using Universal Image loader to handle images, My requirement is I have to display an small animated progress bar on the place of exact size of image which is going to appear after download,

Can Any body please suggest me how to achieve this, I am struggling with this. Learning android UI slowly. Please help me

below is the code for reference

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

            <TextView
                android:id="@+id/title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginTop="8dp"
                android:textColor="#d9000000"
                android:textSize="20sp"
                android:textStyle="bold"
                />

            <TextView
                android:id="@+id/body"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="10dp"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginTop="8dp"
                android:ellipsize="end"
                android:lineSpacingMultiplier="1.4"
                android:maxLines="4"
                android:textColor="#d9000000"
                android:textSize="16sp"
                />

            <ImageView
                android:id="@+id/image"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="10dp"
                />
        </LinearLayout>

and Using below code in list adapter to upload image

mDisplayImageOptions = new DisplayImageOptions.Builder()
                .cacheInMemory(true)
                .cacheOnDisk(true)
                .build();

mImageLoader.displayImage(url, mImageView, mDisplayImageOptions);

I have checked below links but did not work

Show indeterminate ProgressBar while loading image with Universal Image Loader

Community
  • 1
  • 1
Naga
  • 1,931
  • 4
  • 25
  • 42
  • I am using call backs and its not showing and some one has downvoted , crap stackoverflow is becoming crap slowly because few people love to downvote – Naga Jul 12 '15 at 17:31

1 Answers1

0

just put progress bar under imageview using relative layout so once image view is not empty it will overlay/hide the progress bar, something like this:

 <LinearLayout >

       .........

    <RelativeLayout 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp">

       <ProgressBar
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:id="@+id/progressBar"
           android:layout_centerVertical="true"
           android:layout_centerHorizontal="true" />

        <ImageView
            android:id="@+id/image"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />
     </RelativeLayout>  

ville101
  • 226
  • 1
  • 9