problem with animating items in a GridView

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

problem with animating items in a GridView

Postby clau2000 » Wed Feb 03, 2010 11:42 am

Hi,
I am trying to animate some items in a GridView, when clicking on them.
And, as I want the new position to be kept, I need to have setFillAfter(true).
The problem is that when I am animating an object all the previous animations repeat. By setting setFillAfter(false) I solve this problem, but then I don't keep the new positions. I tried to use clearAnimation before starting a new animation but with no luck.
Here is some code sample

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public void translate(int x1, int y1, int x2, int y2)
  2.  
  3.         {
  4.  
  5.                 trans = new TranslateAnimation(x1, y1, x2, y2);
  6.  
  7.                 trans.setDuration(800);
  8.  
  9.                 trans.setFillAfter(true);
  10.  
  11.          }
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


I add the animation by overriding the onClick function:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. @Override
  2.  
  3.             public void onClick(final View view)
  4.  
  5.             {    
  6.  
  7.                  view.startAnimation(animList.get(0));  
  8.  
  9.             }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Do you have any ideas how to work around this problem? Maybe overriding onClick is not the good approach?
Thanks
clau2000
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Feb 02, 2010 5:58 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot] and 6 guests