可以动画的android改变视图的大小 [英] can android animation change view's size

查看:364
本文介绍了可以动画的android改变视图的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是有可能,通过动画改变图像大小?我想要实现的是我有一个的ImageView ,我想用动画来调整it.make它做大,像我设置的 200dip 在xml文件,动画后成为 500dip 。就是那可能我应该用什么样的方法究竟任何帮助和guideness将高度appeciate.thank你。:D

is it possible that change the image size by animation? what I want to achieve is I have an imageView,and I want to use an animation to resize it.make it bigger ,like I set it 200dip in xml file,after the animation it become 500dip.is that possible?what methods should I use exactly?any help and guideness will be highly appeciate.thank you:D.

,或者可以实现这样的效果。

or can realize this effect.

编辑:

我认为我需要更清楚,我有一个屏幕上的 800dip 。而两个视点,第一个是的 200dip ,另一个就是 600dip 。所以第二个大小是由屏幕尺寸计算 - 第一尺寸,我不知道我是否通过动画更改第一个ImageView的大小为 600dip 当然第二ImageView的成为 200 自动的,可能发生的呢?

I think I need to make it more clear,I have a screen 800dip.and two view ,first is 200dip,another is 600dip.so the second size is calculate by screen size - first size,and I wonder if I change the first imageView size to 600dip by animation,and of course the second imageView become 200 automatic,could that happen?

推荐答案

您动漫变化查看hierarchi PARAMS,所以你应该申请新的布局PARAMS(LP)到ImageView的。

Your animation changes view hierarchi params so you should apply new layout params (lp) to ImageView.

创建一个将应用新的LP ImageView的每一帧设定不同的宽度/高度自定义动画。所以,你的图像视图会增加它的大小和移动其他意见。有很多例子来说明如何实现这一点。 看看这个

Create custom animation which will apply new lp to ImageView setting different width/height on every frame. So your image view will increase it's size and move other views. There are a lot examples how to implement this. Take a look at this one.

    @Override
    protected void applyTransformation(float interpolatedTime, Transformation t) {
        android.view.ViewGroup.LayoutParams lp = mContent.getLayoutParams();
        lp.height = (int) (mStartHeight + mDeltaHeight * interpolatedTime);
        mContent.setLayoutParams(lp);
    }

这篇关于可以动画的android改变视图的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆