按钮闪烁的Andr​​oid TranslateAnimation按钮、Andr、TranslateAnimation、oid

2023-09-08 09:44:43 作者:深忆病人

如果你在一个按钮,然后只绘图移动,但不是真正的按钮进行TranslateAnimation,所以你必须给自己用animationlistener移动的按钮。

If you perform a TranslateAnimation on a button then only the drawing moves but not the real button, so you have to move the button yourself with an animationlistener.

现在你知道我已经知道了,做这个工作的。

Now you know what I already know and did and this works.

问题在于用户看到的。动画后(所以当我移动的按钮),你看到屏幕上短暂闪烁。这是由于绘图已经是了,后来我改变按钮的边缘使绘图更加向上移动,谈到轰然倒下,因为它被设置为假fillAfter之前

The problem lies in what the user sees. After the animation (so when I move the button) you see a short flickering in the screen. This is due to the drawing already being up, then I change the margin of the button so the drawing moves up even more, before it comes crashing down because of the fillAfter which is set to false

这是如何解决这一问题的任何想法?它也可以是一个整体的其他方法(没有翻译动画例如)但效果需要是相同的(不闪烁ofcourse))

Any ideas on how to fix this? It may also be a whole other approach (without a translate-animation for example) but the effect needs to be the same (without the flicker ofcourse ;) )

推荐答案

有当面对同样的问题,就是一块答案的文字,我自己的问题。

There is piece of text of answer to my own question when faced the same problem

通过上述方法。这里放置,以便在动画结束新的位置后仍然来自闪烁的另一个问题,就是由于android的动画侦听器方法的问题,就是它被前实际动画结束所谓的并导致闪烁效果,一个棘手的解决方案,它是通过把code的下面一行在公共无效onAnimationEnd的第一行(动画)方法

"After placing the view to new position at the end of animation by using above method. And here still comes another problem of blinking which is due to the problem in android animation listener method which is that it gets called before actually animation ends and causes blinking effect, a tricky solution to it is by putting following line of code at first line of public void onAnimationEnd(Animation a) method"

// in my case animation applied to notes_editor so the code will be 
  notes_editor.clearAnimation();

在这里完整的答案链接

for complete answer here is link

EditText动画和活着回来滚动后stucks ......?