我试图在 ma 应用程序中集成进度条。但我无法跟踪回调方法。进度条总是显示。当图像被加载时如何隐藏?
holder.imageView = (ImageView) localView.findViewById(R.id.imageView1);
holder.progressBar = (ProgressBar) localView.findViewWithTag(R.id.progressBar1);
localView.setTag(holder);
url = getItem(paramInt);
Picasso.with(getApplicationContext())
.load(url)
.placeholder(R.drawable.ic_launcher)
.error(R.drawable.ic_launcher)
.fit()
.into(holder.imageView, new Callback() {
@Override
public void onSuccess() {
holder.imageView.setVisibility(View.VISIBLE);
holder.progressBar.setVisibility(View.INVISIBLE);
}
@Override
public void onError() {
holder.progressBar.setVisibility(View.VISIBLE);
holder.imageView.setVisibility(View.INVISIBLE);
}
});