diff --git a/app/src/main/java/saulmm/myapplication/AvatarImageBehavior.java b/app/src/main/java/saulmm/myapplication/AvatarImageBehavior.java index e995f1c..89085ab 100644 --- a/app/src/main/java/saulmm/myapplication/AvatarImageBehavior.java +++ b/app/src/main/java/saulmm/myapplication/AvatarImageBehavior.java @@ -84,6 +84,11 @@ public boolean onDependentViewChanged(CoordinatorLayout parent, CircleImageView * (1f - expandedPercentageFactor)) + (child.getHeight()/2); child.setX(mStartXPosition - distanceXToSubtract); + + int maxYDistance = (mStartYPosition - mFinalYPosition) + (mCustomFinalHeight / 2); + if (distanceYToSubtract > maxYDistance) + distanceYToSubtract = maxYDistance; + child.setY(mStartYPosition - distanceYToSubtract); float heightToSubtract = ((mStartHeight - mCustomFinalHeight) * heightFactor);