I have a recycler view. On a button click I want to remove all the items from the recyclerview but the items must be removed with animation. I am able to remove all the items at once but I don't know how to remove them with animation. Thanks
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
This is how I have done without using any libraries - by inserting delays in the loop to remove items & restore (if needed)
It's old, but wish this helps someone else as it's already not answered yet; I have done it by deleting a single item at a time by simulating a swipe animation on this item, and post a delay before deleting the next item, and so on to the way down to the last item of the
RecyclerView
Step No.1:
In your activity that holds the clear all button and the
RecyclerView
instance: Create a method of single item deleteStep No.2:
Create the method that will delete all
RecyclerView
list items >> call it in your button click callback.Also it's important to handle configuration change in manifest, activity section, as if the configuration changes while clearing your recycler view list, an exception will be raised
This is a pretty good library and what's better is the documentation for it. You can even insert durations for transitions and animations.
Also, remember that if you are using default animation, after calling
myDataSet.remove(pos)
usingadapter.notifyDataSetChanged()
while there is an animation ongoing will cause the animation to stop.Extend BaseItemAnimator class of recyclerview-animators library:
...
...