1

I created a code that animates all the children of the ListView except the position 1.

enter image description here

if I reduce the application with the "home" button and I come back on, the animation of the view at position 1 is not launched. So if I press a "Preferences" button in the action bar which launches another activity, and then I press the "back" button, the animation is started.

Also, if I click on the item, the animation is started.

Finally, if I scroll to hide the view at position 1 and I scroll to draw again, the animation is started.

I do not think posting the code is useful because it works for all other views.

I tried to use the "convertView" of the Adapter, I also try to redraw the whole, it does not work. I hope that the solution lies in an option to enable it in the ListView. Thank you.

julien dumortier
  • 1,303
  • 1
  • 13
  • 28

2 Answers2

0

I have the same problem. I just noticed that the view at position 1 is redrawn (in the getView method of the adapter) more times than others view.

unamedUser
  • 23
  • 6
0

Your listview layout_width and layout_height attr. are match_parent? If listview layout attrs are wrap_content, it called getView every width or height changing.

Optimize adapter code but your code want position variable shouldn't use. Because very dangerous row cached.


    if( convertView == null){
     // inflate
     ...
     convertView.setTag(holder);
    }else{
     holder = ((Holder)convertView.getTag());
    }

...

Other options very simply but not fast and memory friendly


    // inflate convertView
    convertView = inflater.inflate(, );
    // than use convertViews child view

nurisezgin
  • 1,530
  • 12
  • 19