Last active
August 29, 2015 14:28
-
-
Save umetsu/d63e4db01fbf3e2a3733 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.prunusmume.sample; | |
import android.view.View; | |
import android.view.animation.Animation; | |
import android.view.animation.Transformation; | |
public class WidthAnimation extends Animation { | |
private final View mTargetView; | |
private final int mStartWidth; | |
private final int mTargetWidth; | |
public WidthAnimation(final View targetView, final int startWidth, final int targetWidth) { | |
mTargetView = targetView; | |
mStartWidth = startWidth; | |
mTargetWidth = targetWidth; | |
} | |
@Override | |
protected void applyTransformation(final float interpolatedTime, final Transformation t) { | |
mTargetView.getLayoutParams().width = (int) (mStartWidth + (mTargetWidth - mStartWidth) * interpolatedTime); | |
mTargetView.requestLayout(); | |
} | |
@Override | |
public boolean willChangeBounds() { | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment