Android : Animation to load items in GrdView at entryPoint look like ItemAnimator in RecyclerView

on Sunday, March 22, 2015


I looked at LollipopShowcase sample - Youtube link.


As you see in the entry point, items of RecyclerView will be animated from left. To achieve this in the implementation we set ItemAnimator for RecyclerView:



mRecyclerView.setItemAnimator(new CustomItemAnimator());


CustomItemAnimator is extending RecyclerView.ItemAnimator. Implementation can we found here.


I wonder how we can achieve same result in a ListView or GridView?


Please provide some explanation and code and do not refer to any third party library.


Imagine a case that I have a callback after a API call and want to refresh my GridView:



@Override
public void onResponse(List<Item> response) {
items.clear();
for (final Item item: response) {
mItems.add(item);
mAdapter.notifyDataSetChanged();
}
}

0 comments:

Post a Comment