我正在尝试ImageView
使用 ViewPropertyAnimator 以可变持续时间淡入,但我无法让它工作。
这是我用于淡出的代码,效果很好:
final ImageView imageView = (ImageView)mView.findViewById(R.id.image_view);
Picasso.with(mView.getContext()).load(mItem.thumbnailURL).into(imageView, new Callback() {
@Override
public void onSuccess() {
imageView.animate().alpha(0).setDuration(duration).start();
}
...
});
但如果我尝试反转淡入的方向,图像永远不会出现:
final ImageView imageView = (ImageView)mView.findViewById(R.id.image_view);
imageView.setAlpha(0);
Picasso.with(mView.getContext()).load(mItem.thumbnailURL).into(imageView, new Callback() {
@Override
public void onSuccess() {
imageView.animate().alpha(1).setDuration(duration).start();
}
...
});
为什么alpha值永远不会增加?动画是否在不同的 Alpha 通道上运行setAlpha
?