2014-10-22 22 views
3

我使用Android的查询库试图在listadapter图片的加载, 我的问题是进度显示,但图像加载后不disapearing完全Aquery形象进度着隐藏

我跟着aquery文档

看到这个

String imageUrl = "http://farm6.static.flickr.com/5035/5802797131_a729dac808_b.jpg";    
aq.id(R.id.image).progress(R.id.progress).image(imageUrl, false, false); 

和布局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="100dip" 
    > 

    <ProgressBar     
     android:layout_width="15dip"  
     android:layout_height="15dip" 
     android:id="@+id/progress" 
     android:layout_centerInParent="true" 
     /> 

    <ImageView 
     android:id="@+id/image"  
     android:layout_width="fill_parent"  
     android:layout_height="75dip" 
     /> 

</RelativeLayout> 

在我的代码它就像

public View getView(int position, View convertView, ViewGroup parent) { 
       ViewHolder holder; 
       if (convertView == null) { 
        holder = new ViewHolder(); 
       convertView = mInflater.inflate(
         R.layout.galleryitem, null); 
       holder.imageview = (ImageView) convertView.findViewById(R.id.thumbImage); 

       convertView.setTag(holder); 
      } 
      else { 
       holder = (ViewHolder) convertView.getTag(); 
      } 

      holder.imageview.setId(position); 

      holder.checkbox.setVisibility(View.GONE); 
      holder.imageview.setOnClickListener(new OnClickListener() { 

       public void onClick(View v) { 
        // TODO Auto-generated method stub 
        int id = v.getId(); 
        Intent ia = new Intent(getApplicationContext(),PreviewImage.class); 
        ia.putExtra("url",id); 
        startActivity(ia); 

       } 
      }); 

      AQuery aq = new AQuery(convertView); 

      try{ 
      aq.id(holder.imageview).image(arrPath[position]).progress(R.id.progress); 
      } 
      catch(Exception e) 
      {} 

      holder.id = position; 
      return convertView; 
     } 
    } 

回答

4

使用本

aq.id(holder.imageview).progress(R.id.progress).image(arrPath[position], false, false); 
+0

工作,但为什么以前没有工作,这是同我以前 aq.id(holder.imageview)图像配(arrPath [位置])进展(R.id.progress)。 之前只增加了进度,其非常不自然的行为 – 2014-10-22 10:14:56