Aquery图像进度条无法隐藏

3
我正在使用Android Query库尝试在ListAdapter中加载图片,但出现了一个问题:进度条一直显示而没有消失,即使图像已经完全加载完成。我遵循了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;
        }
    }
1个回答

4

使用这个

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

它能工作,但为什么之前不能工作,它与我的以前的aq.id(holder.imageview).image(arrPath[position]).progress(R.id.progress)相同;只是在之前添加了progress,这是非常不自然的行为。 - Kishor datta gupta

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接