1

Using an ArrayAdapter and an Android Listview, I would like to be able to automatically start an animation with each row of the Listview, when the element is added or removed from my ArrayList.

I found a lot of tutorials, but they work with a onItemClickListener, so the animation is started when the user clicks on a row. In my case, rows are added programmatically, and might be deleted anytime by my app. I can't find the easiest way to access the view related to the ArrayList element I am dealing with.

I would like the animations to be quite long (30 seconds), so even if the view isn't currently visible on the listview, I would like the animation to be engaged when the user will scroll to the view.

Scaraux
  • 3,841
  • 4
  • 40
  • 80
  • 1
    That will be easier if you switch to `RecyclerView`, which has [a whole system set up for this](http://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemAnimator.html). – CommonsWare Apr 23 '16 at 15:58
  • Thanks. Do you have anything I could read to learn how to do what I want ? Will my adapter work with a RecyclerView ? – Scaraux Apr 23 '16 at 16:04
  • `RecyclerView` has its own `RecyclerView.Adapter`, which is reminiscent of `BaseAdapter` but not quite identical. There is [at least one library of canned animators](https://github.com/wasabeef/recyclerview-animators). Beyond that, use a search engine and search on `recyclerview itemanimator fade` or something. – CommonsWare Apr 23 '16 at 16:17
  • I'll do that. Thank you – Scaraux Apr 23 '16 at 17:06
  • Answer my post, so I can accept it :) – Scaraux Apr 28 '16 at 07:47
  • I did not answer the question as written. I merely pointed you in a different direction. You might consider answering the question yourself, if you worked out a solution. – CommonsWare Apr 28 '16 at 10:39

0 Answers0