admin管理员组

文章数量:1565816


2024年6月12日发(作者:)

本文由我司收集整编,推荐下载,如有疑问,请与我司联系

如何动画相对布局的缩放(其中包含许多布局和ImageViews)

如何动画相对布局的缩放(其中包含许多布局和ImageViews)[英]How to

animate scaling of a relative layout(Which contains many layouts and ImageViews inside)

I tried with scaling but while scaling layouts inside are shrinking, Can anyone explain how

to animate a layout without shrinking

 我尝试使用缩放,但是当内部缩放布局缩小时,任何人都可以解释如何在不收缩的情

况下为布局设置动画

  need to scale letterLayout from a little bit above the parent bottom to top

 需要从父母的底部到顶部稍微扩展一下letterLayout

  Animation anim = new ScaleAnimation( 1f, 1f, // Start and end values for the X axis

scaling startScale, endScale, // Start and end values for the Y axis scaling

VE_TO_SELF,

VE_TO_SELF,

0f,

1f);

//

//

Pivot

Pivot

point

point

of

of

X

Y

scaling

scaling

lAfter(false); // Needed to keep the result of the animation

ation(1000); nimation(anim); Layout code

  RelativeLayout xmlns:android=“d/apk/res/android”

xmlns:tools=“d/tools”

android:layout_height=“match_parent”

xmlns:app=“d/apk/res-auto”

android:layout_width=“match_parent”

tools:context=“ScreenActivity” 0

 I would suggest you to use a Value animator like this and change the margins of the

RelativeLayout:

 我建议你使用像这样的Value animator并改变RelativeLayout的边距:

  final Params params = (Params)

ValueAnimator va = outParams();

(initialMargin, finalMargin); int mDuration = 3000; //in millis

ation(mDuration); ateListener(new


本文标签: 缩放布局我司