title: Problems with fade in/out animation selector when scroll the gridview
body: <p>I'm having problems when scroll my gridview, 'cause the selector that highlight the selected cells are appearing in other cells too (for a while) just during the scrolling. This problems starts after I add a <code>fadeIn</code> and <code>fadeOut</code> animations to this selector, but I really want to let the animation, in order to a smoother transition. </p>
  
  <p>My adapter code to this grid is:</p>
  
  <pre><code>public class GridAdapter extends BaseAdapter {
  
      private Context ctx;
      private List&lt;Model&gt; modelList;
  
      public GridAdapter(Context ctx, List&lt;Model&gt; modelList) {
          this.ctx = ctx;
          this.modelList = modelList;
      }
  
      @Override
      public int getCount() {
          return modelList != null ? modelList.size() : 0;
      }
  
      @Override
      public Object getItem(int pos) {
          return modelList.get(pos);
      }
  
      @Override
      public long getItemId(int pos) {
          return pos;
      }
  
      @Override
      public View getView(int pos, View view, ViewGroup viewGroup) {
  
          final ViewHolder holder;
  
          if (view == null) {
              holder = new ViewHolder();
  
              view = LayoutInflater.from(ctx).inflate(R.layout.grid_cell, viewGroup, false);
  
              holder.gridCell = (TextView) view.findViewById(R.id.grid_cell);
              holder.cellSelected = (TextView) view.findViewById(R.id.cell_selected);
  
              view.setTag(holder);
          } else {
              holder = (ViewHolder) view.getTag();
          }
  
          Model model = modelList.get(pos);
  
          holder.gridCell.setBackgroundResource(model.getBackId());
          holder.gridCell.setText(model.getLabel());
  
          if (model.isSelected()) {
              //fade In
              holder.cellSelected.setBackgroundResource(R.drawable.grid_selector);
              holder.cellSelected.setVisibility(View.VISIBLE);
              holder.cellSelected.animate().setDuration(1000).alpha(1.0f).setListener(new Animator.AnimatorListener() {
                  @Override
                  public void onAnimationStart(Animator animator) {
  
                  }
  
                  @Override
                  public void onAnimationEnd(Animator animator) {
                      holder.cellSelected.setAlpha(1.0f);
                      holder.cellSelected.setVisibility(View.VISIBLE);
                  }
  
                  @Override
                  public void onAnimationCancel(Animator animator) {
  
                  }
  
                  @Override
                  public void onAnimationRepeat(Animator animator) {
  
                  }
              }).start();
          } else {
              //fade out
              holder.cellSelected.animate().setDuration(1000).alpha(0.0f).setListener(new Animator.AnimatorListener() {
                  @Override
                  public void onAnimationStart(Animator animator) {
  
                  }
  
                  @Override
                  public void onAnimationEnd(Animator animator) {
                      holder.cellSelected.setBackgroundResource(0);
                      holder.cellSelected.setAlpha(0.0f);
                      holder.cellSelected.setVisibility(View.INVISIBLE);
                  }
  
                  @Override
                  public void onAnimationCancel(Animator animator) {
  
                  }
  
                  @Override
                  public void onAnimationRepeat(Animator animator) {
  
                  }
              }).start();
          }
  
          return view;
      }
  
      private class ViewHolder {
          TextView gridCell;
          TextView cellSelected;
      }
  }
  </code></pre>
  
  <p>Anyone knows what I have to change to stop this incorrect showing of the selector in other cells (don't selected one.)?</p>
  
  <p>Any sugestion?</p>
  
  <p><strong>Note</strong> - both fadeIn and fadeOut works to cells that have to be selected, the only problem is during the scroll, some cells that should be unselected for a little while are animated too.</p>
  
  <p><strong>EDITED</strong> - Actually I think the problem is when recycle the view on grid, but I don't know how resolve it yet. Please, that is the only thing missing on project.</p>
  
  <p>Thanks</p>