android中的动画可以改变一个view的高和宽吗

2025-04-15 09:00:11
推荐回答(1个)
回答1:

 类似效果,自己的动画改变view布局参数,应该对imageView应用新的布局参数。

  创建应用新布局参数(lp)的自定义动画,对不同imageView每个框架都设置不同高宽。然后图片就可以增大尺寸,并且移动其他图片,这样的例子在网上可以找到。

  @Override
  protected void applyTransformation(float interpolatedTime, Transformation t) {
  android.view.ViewGroup.LayoutParams lp = mContent.getLayoutParams();
  lp.height = (int) (mStartHeight + mDeltaHeight * interpolatedTime);
  mContent.setLayoutParams(lp);
  }