与动画更新布局 [英] Update layout with the animation

查看:117
本文介绍了与动画更新布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义视图从LinearLayout中继承。它包含一个按钮 和的EditText。 EditText上具有初始可见性设置为不见了。什么时候 按钮是pressed我想要的EditText出现动画效果。所以 我做了一个ScaleAnimation,当按钮被pressed我设置 的EditText#setVisibility(可见),并启动动画。问题 是,它需要的空间为100%和动画内那些执行 边界。因此,当有更多的视图的下面放置他们正在向下移动 马上,但我希望他们能够慢慢移动,动画 进展。有没有办法做到这一点?

I have a custom View inherited from LinearLayout. It contains a Button and a EditText. EditText has initial visibility set to GONE. When Button is pressed I want EditText to appear with animation effect. So I've made an ScaleAnimation and when Button is pressed I set EditText#setVisibility(VISIBLE) and start the animation. The problem is that it takes 100% of space and animation is performed inside those bounds. So when there are more View's placed below they are moved down immediately, but I want them to move slowly as the animation progresses. Is there any way to do this?

推荐答案

我用通过覆盖动画applyTransformation方法,根据改造,解决我的问题,并调用视图的setLayoutParams。

I've used to solve my issue by overriding applyTransformation method of Animation and call View's setLayoutParams according to transformation.

这篇关于与动画更新布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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