Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android TranslateAnimation on button flickers

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.

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

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 ;) )

like image 570
vanleeuwenbram Avatar asked Dec 07 '11 07:12

vanleeuwenbram


1 Answers

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

"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 after animation and alive back on scrolling......?

like image 143
Umar Qureshi Avatar answered Sep 25 '22 11:09

Umar Qureshi