-
Notifications
You must be signed in to change notification settings - Fork 276
4. Custom Enter&Exit Animations
Faruk Toptaş edited this page Aug 21, 2017
·
1 revision
Note: fancyShowCaseView.removeView()
must be called after animation ends (in onAnimationEnd
method) if custom exit animation is used.
Animation enterAnimation = AnimationUtils.loadAnimation(this, R.anim.slide_in_top);
Animation exitAnimation = AnimationUtils.loadAnimation(this, R.anim.slide_out_bottom);
final FancyShowCaseView fancyShowCaseView = new FancyShowCaseView.Builder(this)
.focusOn(view)
.title("Custom enter and exit animations.")
.enterAnimation(enterAnimation)
.exitAnimation(exitAnimation)
.build();
fancyShowCaseView.show();
exitAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
fancyShowCaseView.removeView();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="-100%p" android:toYDelta="0"
android:duration="@android:integer/config_mediumAnimTime"/>
</set>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="0" android:toYDelta="100%p"
android:duration="@android:integer/config_mediumAnimTime"/>
</set>