Android定制动画,如机场时间表板

时间:2011-09-06 05:55:18

标签: android animation customization uiviewanimation

我想为航班时刻表上的机场创建动画。从顶部删除并更改其上的文本。这是图像。所以当我点击按钮时,图像上的文字应该随着所述动画而改变。有可能与android?

enter image description here

请指导我如何在android中实现这种动画?

修改

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false">
    <item android:drawable="@drawable/clockbg1" android:duration="150" />
    <item android:drawable="@drawable/clockbg2" android:duration="150" />
    <item android:drawable="@drawable/clockbg3" android:duration="150" />
    <item android:drawable="@drawable/clockbg4" android:duration="150" />
    <item android:drawable="@drawable/clockbg5" android:duration="150" />
    <item android:drawable="@drawable/clockbg6" android:duration="150" />
</animation-list>

我的活动类:

public class XMLAnimation extends Activity {
private static AnimationDrawable animation;
private ImageView refresh;

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);

    refresh = (ImageView) findViewById(R.id.simple_anim);
    refresh.setBackgroundResource(R.drawable.loader_animation);
    animation = (AnimationDrawable) refresh.getBackground();
}

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    animation.start();
}

enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here

现在如何在这些图像上放置垂直动画文本,使其看起来像我想创建的动画?

谢谢, AndroidVogue

2 个答案:

答案 0 :(得分:1)

这不完全是你想要的东西,但凯文迪翁有一个很好的3部分教程,启动here来创建一个看起来像你想要的自定义里程表小部件。它应该有助于你开始。

要获得上半部分字母落下的效果(如果这是您想要的),您可以通过将字母绘制到缓冲区图像然后缩放字母的垂直范围以获得透视效果来伪造它

答案 1 :(得分:0)

我有工作的图书馆。最初由其他人开发,但我从Froyo提供了对版本的支持。我希望这可以帮助你。

AbhanFlipView

价:

图书馆开发者:Emil Sjölander 动画创建者:Jake Wharton

<强>更新

它有一个名为HowTo.txt的文档,展示了如何集成。

感谢。