0

In my app I have a ListView that's populated by a custom adapter. Each row is been inserted by pressing a button. After the new row has been inserted into the ListView, I want an Alpha Animation to start in order to display the new row. Here is my code :

//executed when button is pressed
public void grabColors(int colorDrawable1,int colorDrawable2,int colorDrawable3,int colorDrawable4,String correctColors,String correctPositions){

              AllColors.add(new ColorRow(colorDrawable1, colorDrawable2, colorDrawable3, colorDrawable4, correctColors, correctPositions));

              ma.notifyDataSetChanged();
              //int j=0; 
              View v = getViewByPosition(j,lv);

              //LinearLayout is set to android:visibility="invisible"
              LinearLayout lr = (LinearLayout) v.findViewById(R.id.row);
              lr.setVisibility(View.VISIBLE);
              lr.animate().alpha(1.0f).setDuration(1000);
              j++;



    }

The new row is been inserted into the ListView like it is supposed to, BUT the alpha animation never kicks in, leaving the row in it's invisible state. Do you have any idea why this happens?

P.S I also tried to run the alpha animation inside the adapter where the row's view is first created and it is working, but whenever the view is recycled the alpha animation kicks again.

The Original Android
  • 6,147
  • 3
  • 26
  • 31
SoCo
  • 1,934
  • 2
  • 15
  • 20

0 Answers0