Skip to content Skip to sidebar Skip to footer

Can Android Animation Change View's Size

is it possible that change the image size by animation? what I want to achieve is I have an imageView,and I want to use an animation to resize it.make it bigger ,like I set it 200d

Solution 1:

Your animation changes view hierarchi params so you should apply new layout params (lp) to ImageView.

Create custom animation which will apply new lp to ImageView setting different width/height on every frame. So your image view will increase it's size and move other views. There are a lot examples how to implement this. Take a look at this one.

@OverrideprotectedvoidapplyTransformation(float interpolatedTime, Transformation t) {
        android.view.ViewGroup.LayoutParamslp= mContent.getLayoutParams();
        lp.height = (int) (mStartHeight + mDeltaHeight * interpolatedTime);
        mContent.setLayoutParams(lp);
    }

Post a Comment for "Can Android Animation Change View's Size"