Smoothly delete items in a custom list

I want to be able to remove items from a list in a view that will animate both the deleted item and the items below it, similar to the one shown for demonstrating layoutAnimations in the API demos.

For example:

enter image description here

Here I want to delete element 1. The first animation will smoothly move element 1 to the right, and upon completion it will smoothly animate all the elements below this element (including more elements, if any) to an empty place in which this element 1 is used.

The first animation was pretty simple:

final TranslateAnimation animation = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_SELF, 0.0f, TranslateAnimation.RELATIVE_TO_SELF, 1.0f, TranslateAnimation.RELATIVE_TO_SELF, 0.0f, TranslateAnimation.RELATIVE_TO_SELF, 0.0f); animation.setDuration(500); view.startAnimation(animation); 

But how to achieve a good effect from other elements, where I actually use a listView that processes its elements?

In the demo that I mentioned, they don't even use listView. In my case, this is quite problematic since I have a lot of items.

I also noticed a similar article about this , but all I found is that you need to change the listView code, but there is no real solution.

By the way, the minimum sdk is 9.

+7
source share
1 answer

I found a good sample that does almost what I wanted, but unfortunately API 12 is required to run, plus I managed to collapse it somehow.

Sample can be found here .

The website also has other nice designs and interesting Android user interface views.

Hopefully someone can find a way to make it available to lower API levels, as statistics still show that many of them have API 10.


EDIT: The links are dead. However, this is possible using RecyclerView. You can even use the scroll down function, as shown here .

0
source

All Articles