Reputation: 191
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 200dip in xml file,after the animation it become 500dip.is that possible?what methods should I use exactly?any help and guideness will be highly appeciate.thank you:D.
or can realize this effect.
EDIT:
I think I need to make it more clear,I have a screen 800dip.and two view ,first is 200dip,another is 600dip.so the second size is calculate by screen size - first size
,and I wonder if I change the first imageView size to 600dip by animation,and of course the second imageView become 200 automatic,could that happen?
Upvotes: 2
Views: 6147
Reputation: 10518
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.
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
android.view.ViewGroup.LayoutParams lp = mContent.getLayoutParams();
lp.height = (int) (mStartHeight + mDeltaHeight * interpolatedTime);
mContent.setLayoutParams(lp);
}
Upvotes: 1