Im animating my header view on scroll via the view animation classes as following:
view.animate()
.translationY(-view.getBottom())
.alpha(0)
.setDuration(HEADER_HIDE_ANIM_DURATION)
.setInterpolator(new DecelerateInterpolator());
Problem is that the view below the view im translating is not filling up translated views empty space:


My layout looks somethin like this:
<LinnearLayout>
<include layout"toolbar" /> //included layout which is the view translated
<FrameLayout /> //fragment container
</LinnearLayout>
How do i solve this issue?
Do you try to fade away your toolbar? Try to manipulate your FrameLayout manually. Something like this:
ObjectAnimator animator = ValueAnimator.ofFloat(0, -view.getBottom());
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
toolbar.setTranslationY(-animation.getAnimatedValue)
mFrameLayout.layout(mFrameLayout.getLeft(), animation.getFraction() * mToolbar.getHeight(), mFrameLayout.getRight(), mFrameLayout.getBottom());
}
});
toolbar.startAnimation(animator);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With