繁体   English   中英

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

[英]Animate image view current position to top - left corner

我有相对布局,在该布局中,我的图像视图看起来像一张图像。 我想制作6个图像视图的动画。 3个是right_top,right_center,right_bottom ,另外3个是left-top,left-center,left-bottom 所有这些都只在其父级布局内...

我想实现完全像这个图像

希望可以为您提供帮助。

而且,如果您想为游览动画添加缩放比例,请在每个动画集中添加此比例

<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" />

西德胡,抱歉。

  @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是这样的:

在此处输入图片说明 在此处输入图片说明

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM