title: How to animate individual elements in ListView
body: <p>I'm doing a small Android app based around a ListView. When the user selects one or more elements in the list and subsequently selects a menu item from the ActionBar I would like to do a small animation on the selected elements in the list, and this is where things go wrong.</p>
  
  <p>Nothing animates - nor does anything fail. The following code piece is a simplified version of what I'm doing:</p>
  
  <pre><code>private void animateListViewItem()
  {
      TranslateAnimation anim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,Animation.RELATIVE_TO_SELF, 0.0f,
              Animation.RELATIVE_TO_SELF, -1.0f,Animation.RELATIVE_TO_SELF, 0.0f);
      anim.setDuration(2000);
      View v = fragment.getListAdapter().getView(fragment.getListView().getFirstVisiblePosition(), null, null);
      v.startAnimation(anim);
  }
  </code></pre>
  
  <p>When I messed around with it, trying to figure out what was wrong, I at one point substituted the item with the entire ListView to rule out the animation as the source of the problem - like this.</p>
  
  <pre><code>private void animateListViewItem()
  {
      TranslateAnimation anim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,Animation.RELATIVE_TO_SELF, 0.0f,
              Animation.RELATIVE_TO_SELF, -1.0f,Animation.RELATIVE_TO_SELF, 0.0f);
      anim.setDuration(2000);
      fragment.getListView().startAnimation(anim);
  }
  </code></pre>
  
  <p>To my amazement, that worked perfect!</p>
  
  <p>So my question is - why can't I animate the individual elements in a ListView? Or is there something I am doing wrong?</p>
  
  <p>Thanks!</p>
  
  <p>P.S. For the record the ListView is populated with custom views (LinearLayouts), and I have checked that I get the right item before animating. </p>