单动画 - 多视图视图、动画

由网友(雾络.)分享简介:有没有什么办法的动画在同一时间多个视图?Is there any way to animate multiple views at the same time?我想要做的是翻译的动画:What I want to do is translate animations:我有5 TextViews和4色条(普通Re...

有没有什么办法的动画在同一时间多个视图?

Is there any way to animate multiple views at the same time?

我想要做的是翻译的动画:

What I want to do is translate animations:

我有5 TextViews和4色条(普通RelativeLayouts与背景)。在动画的开始时,高新区被堆叠在一个水平行的TextViews。最后我希望所有的堆叠条之间的TextViews:

I have 5 TextViews and 4 coloured strips (plain RelativeLayouts with a background). At the start of the animations, the stips are stacked with the TextViews in a horizontal row. At the end I want all the TextViews stacked between the strips:

这是一个非常简单的绘图,但它说明了我想做的事情。有没有什么办法与动画这样做的,或者我必须使用画布的动画。

This is a very simple drawing, but it demonstrates what I want to do. Is there any way of doing this with animations, or do I have to use canvas animations.

推荐答案

创建动画对象,然后使用 startAnimation 集体所有的观点在同一时间。因此,这将是这样的:

Create your animation objects, then use startAnimation collectively on all views at the same time. So it would be something like this:

TranslateAnimation anim1;
TranslateAnimation anim1;
TranslateAnimation anim1;

// Setup the animation objects

public void startAnimations()
{
   //... collect view objects
   view1.startAnimation(anim1);
   view2.startAnimation(anim2);
   view3.startAnimation(anim3);
}

只要注意,更多的动画,你马上去上,慢这将是。

Just note that the more animations you have going on at once, the slower it's going to be.

阅读全文

相关推荐

最新文章