动画图像查看当前位置到左上角

时间:2015-11-20 07:10:14

标签: android

我有相对布局,在该布局中我有图像视图,它们看起来像一个图像。我想为6个图像视图设置动画。 3是right_top,right_center,right_bottom,另外3是left-top,left-center,left-bottom。并且所有这些都只在其父布局中......

我希望与this image完全一样。

2 个答案:

答案 0 :(得分:1)

希望THIS可以帮助你。

如果您想为漫游动画添加缩放,请在每个动画集中添加此缩放

<scale
            android:fromYScale="1.0"
            android:toYScale="0.5"
            android:startOffset="0"
            android:duration="1200"
            android:fromXScale="1.0"
            android:toXScale="0.5"
            android:fillAfter="true" />

答案 1 :(得分:0)

siddhu,很抱歉。

  @Override
public void onClick(View v) {

    TranslateAnimation mAnimation1 = new TranslateAnimation(0, mImageViewX.getX(),
            mImageView1.getY(), mImageViewX.getY());
    mAnimation1.setDuration(500);
    mAnimation1.setFillAfter(true);
    mImageView1.startAnimation(mAnimation1);

    TranslateAnimation mAnimation2 = new TranslateAnimation(0,
            - mImageViewX.getX(), mImageView2.getY(), mImageViewX.getY());
    mAnimation2.setDuration(500);
    mAnimation2.setFillAfter(true);
    mImageView2.startAnimation(mAnimation2);

    TranslateAnimation mAnimation3 = new TranslateAnimation(0, mImageViewX.getX(),
            mImageView3.getX(), -mImageViewX.getY());
    mAnimation3.setDuration(500);
    mAnimation3.setFillAfter(true);
    mImageView3.startAnimation(mAnimation3);

}

xml是这样的:

enter image description here enter image description here

你应该首先学习animation ..这并不难。 android.view.animation.TranslateAnimation.TranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta) ```

相关问题