title: RecyclerView ItemAnimator glitch in Android L
body: <p>I'm trying to use the new <code>RecyclerView</code>'s <code>ItemAnimator</code> to use a different animation than <code>DefaultItemAnimator</code> for item removal. The default one works well, but when I use mine, the deleted item stays "imprinted" in the <code>RecyclerView</code>s background and the animation and other items are just drawn over it.</p>
  
  <p>Here's my overriden <code>ItemAnimator</code> :</p>
  
  <pre><code>public static class ItemAnimator extends RecyclerView.ItemAnimator
  {
    private Activity mActivity;
    private final List&lt;ViewHolder&gt; mPendingRemovals = new ArrayList&lt;ViewHolder&gt;();
    private final List&lt;ViewHolder&gt; mRunningRemovals = new ArrayList&lt;ViewHolder&gt;();
  
    public ItemAnimator(Activity activity)
    {
      super();
      mActivity = activity;
    }
  
    @Override
    public void runPendingAnimations()
    {
      for (final ViewHolder viewHolder : mPendingRemovals)
      {
        Animation animation = AnimationUtils.loadAnimation(mActivity, android.R.anim.slide_out_right);
        animation.setAnimationListener(new Animation.AnimationListener()
        {
          @Override
          public void onAnimationStart(Animation animation) { }
  
          @Override
          public void onAnimationEnd(Animation animation)
          {
            mRunningRemovals.remove(viewHolder);
            dispatchRemoveFinished(viewHolder);
          }
  
          @Override
          public void onAnimationRepeat(Animation animation) { }
        });
  
        viewHolder.itemView.startAnimation(animation);
  
        mRunningRemovals.add(viewHolder);
      }
  
      mPendingRemovals.clear();
    }
  
    @Override
    public boolean animateRemove(RecyclerView.ViewHolder viewHolder)
    {
      mPendingRemovals.add((ViewHolder) viewHolder);
      return true;
    }
  
    @Override
    public boolean animateAdd(RecyclerView.ViewHolder viewHolder)
    {
      return false;
    }
  
    @Override
    public boolean animateMove(RecyclerView.ViewHolder viewHolder, int i, int i2, int i3, int i4) { return false; }
  
    @Override
    public void endAnimation(RecyclerView.ViewHolder viewHolder)
    {
      ((ViewHolder)viewHolder).itemView.clearAnimation();
      mRunningRemovals.remove(viewHolder);
    }
  
    @Override
    public void endAnimations()
    {
      for (ViewHolder viewHolder : mRunningRemovals)
        viewHolder.itemView.clearAnimation();
  
      mRunningRemovals.clear();
    }
  
    @Override
    public boolean isRunning()
    {
      return mRunningRemovals.size() &gt; 0;
    }
  }
  </code></pre>
  
  <p>According to the Android L documentation I believe I implemented all necessary methods and did the proper calls, so I don't see what the error could be.</p>