网格视图中的动画单元格
Animate cell in gridview
我有一个 gridview 并且我正在使用 Picasso 库来填充它,我想为网格中的每个单元格添加一个动画以从底部滑入,这是我所看到和阅读的唯一方法要做到这一点是通过它似乎只支持 .fade 的 Picasso 库,这是真的吗?或者有人知道我可以使用的支持此类功能的库吗?
我建议您使用 Nostra 的通用图像加载器,因为它带有 onLoadingStart() 和 onLoadingComplete() 等函数来设置您的代码
ImageLoader.getInstance().displayImage(photoUrl, imageView,
new ImageLoadingListener() {
@Override
public void onLoadingStarted(String arg0, View arg1) {
// TODO Auto-generated method stub
imageView.setVisibility(View.GONE);
}
@Override
public void onLoadingComplete(String arg0, View arg1,
Bitmap arg2) {
// Here The magic happens , make your ImageView visible and start animation
imageView.setVisibility(View.VISIBLE);
Animation anim=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.animation);
imageView.startAnimation(anim);
}
@Override
public void onLoadingFailed(String arg0, View arg1,
FailReason arg2) {
// Here you can also specify a defferent image from drawable
}
@Override
public void onLoadingCancelled(String arg0, View arg1) {
imageView.setVisibility(View.GONE);
}
});
动画是xml在res文件夹里面的anim文件夹里指定的动画
我有一个 gridview 并且我正在使用 Picasso 库来填充它,我想为网格中的每个单元格添加一个动画以从底部滑入,这是我所看到和阅读的唯一方法要做到这一点是通过它似乎只支持 .fade 的 Picasso 库,这是真的吗?或者有人知道我可以使用的支持此类功能的库吗?
我建议您使用 Nostra 的通用图像加载器,因为它带有 onLoadingStart() 和 onLoadingComplete() 等函数来设置您的代码
ImageLoader.getInstance().displayImage(photoUrl, imageView,
new ImageLoadingListener() {
@Override
public void onLoadingStarted(String arg0, View arg1) {
// TODO Auto-generated method stub
imageView.setVisibility(View.GONE);
}
@Override
public void onLoadingComplete(String arg0, View arg1,
Bitmap arg2) {
// Here The magic happens , make your ImageView visible and start animation
imageView.setVisibility(View.VISIBLE);
Animation anim=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.animation);
imageView.startAnimation(anim);
}
@Override
public void onLoadingFailed(String arg0, View arg1,
FailReason arg2) {
// Here you can also specify a defferent image from drawable
}
@Override
public void onLoadingCancelled(String arg0, View arg1) {
imageView.setVisibility(View.GONE);
}
});
动画是xml在res文件夹里面的anim文件夹里指定的动画