Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public class ResizeAnimation extends Animation {
final int startWidth;
final int targetWidth;
View view;
public ResizeAnimation(View view, int targetWidth) {
this.view = view;
this.targetWidth = targetWidth;
startWidth = view.getWidth();
protected void applyTransformation(float interpolatedTime, Transformation t) {
int newWidth = (int) (startWidth + (targetWidth - startWidth) * interpolatedTime);
view.getLayoutParams().width = newWidth;
public void initialize(int width, int height, int parentWidth, int parentHeight) {
super.initialize(width, height, parentWidth, parentHeight);
public boolean willChangeBounds() {
return true;
ResizeAnimation resizeAnimation = new ResizeAnimation(view, targetSize);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment