2015-07-12 19 views
-1

我具有其中我然后图像和4个选项(A,B,C,d)如何使用通用图像加载器

我使用通用图像加载器显示文本列表中显示图像下载前一动画进展以处理图像,我的要求是我必须显示一个小的动画进度条在图像的下载后将出现的确切大小的地方,

可以任何身体,请告诉我如何做到这一点,我挣扎有了这个。慢慢学习android UI。请帮我

下面

参考

<?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> 

的代码,并在列表适配器使用下面的代码上传图像

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

mImageLoader.displayImage(url, mImageView, mDisplayImageOptions); 

我已经检查下面的链接,但没有工作

Show indeterminate ProgressBar while loading image with Universal Image Loader

+0

我使用回调和它没有显示,有一种已经downvoted,废话计算器正在慢慢变得废话,因为很少有人喜欢downvote – Naga

回答

0

只是把进度条放在imageview下imageview使用相对布局,一旦图像视图不为空,将覆盖/隐藏进度条,这样的事情:

<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> 

+0

让我试试会让你知道 – Naga

+0

我试过这一个不工作 – Naga

+0

你能建议我如何使用这个通用图像加载器 – Naga

相关问题