Reputation: 4113
I'm using the KenBurnsView in the login screen of my App to show several images in the background. The thing is that this images change too abruptly. Isn't a way to implement a fadein/fadeout effect when changing the transitions from one image to another, hooking somewhere in the view API?
This is the code that I'm using to implement the transitions.
private void setupAnimationBackground() {
mBackgroundImageView.setTransitionListener(new KenBurnsView.TransitionListener() {
@DrawableRes int[] mResources = new int[]{
R.drawable.splash1, R.drawable.splash2, R.drawable.splash3,
R.drawable.splash4, R.drawable.splash5, R.drawable.splash6
};
int mIndex = 0;
@Override
public void onTransitionStart(Transition transition) {
mIndex = (mIndex == mResources.length - 1) ? 0 : mIndex + 1;
}
@Override
public void onTransitionEnd(Transition transition) {
mBackgroundImageView.setImageDrawable(ContextCompat.getDrawable(getContext(), mResources[mIndex]));
}
});
}
mBackgroundImageView is a KenBurnsView. I have the images resources in my drawable folder. As you can see I store the references in a resource int array.
Upvotes: 0
Views: 247
Reputation: 6605
Sorry, nope. You need to have two KenBurnsViews one overlapping on top of the other and you handle the crossfading yourself.
Upvotes: 0