下面列出了怎么用com.bumptech.glide.request.animation.ViewPropertyAnimation的API类实例代码及写法,或者点击链接到github查看源代码。
private void loadImageAnimateCode() {
ViewPropertyAnimation.Animator animationObject = new ViewPropertyAnimation.Animator() {
@Override
public void animate(View view) {
view.setAlpha(0f);
ObjectAnimator fadeAnim = ObjectAnimator.ofFloat(view, "alpha", 0f, 1f);
fadeAnim.setDuration(2500);
fadeAnim.start();
}
};
Glide
.with(context)
.load(eatFoodyImages[1])
.animate(animationObject)
.into(imageView2);
}
/**
* {@inheritDoc}
*/
@Override
public DrawableRequestBuilder<ModelType> animate(ViewPropertyAnimation.Animator animator) {
super.animate(animator);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public GifRequestBuilder<ModelType> animate(ViewPropertyAnimation.Animator animator) {
super.animate(animator);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BitmapRequestBuilder<ModelType, TranscodeType> animate(ViewPropertyAnimation.Animator animator) {
super.animate(animator);
return this;
}
/**
* Sets an animator to run a {@link android.view.ViewPropertyAnimator} on a view that the target may be wrapping
* when a resource load finishes. Will only be run if the load was loaded asynchronously (ie was not in the
* memory cache).
*
* @param animator The {@link ViewPropertyAnimation.Animator} to run.
* @return This request builder.
*/
public GenericRequestBuilder<ModelType, DataType, ResourceType, TranscodeType> animate(
ViewPropertyAnimation.Animator animator) {
return animate(new ViewPropertyAnimationFactory<TranscodeType>(animator));
}