To achieve this goal, follow these steps:
First, you need to create a “charred” copy of your list item. To do this, you need to inflate a new view that has the same structure as the list items in your list. After that, you need to add this to the window manager, for example:
WindowManager.LayoutParams windowParams = new WindowManager.LayoutParams(); windowParams.gravity = Gravity.TOP | Gravity.RIGHT; windowParams.x = item.getLeft(); windowParams.y = item.getTop(); windowParams.height = item.getHeight(); windowParams.width = item.getWidth(); windowParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS; windowParams.format = PixelFormat.TRANSLUCENT; windowParams.windowAnimations = 0; View hooveredView = getClonedView(item);
Now create a new Animation class that gets WindowParams, and change the x and y coordinates to move the object processed with hoovered to the bottom bin. Update the new view position using this code:
mWindowManager.updateViewLayout(mViewToAnimate, mWindowParams);
You can also play with width and height to simulate the compression of the view.
To animate the empty space left on the list, you can use my ExpandAnimation described on my blog: http://udinic.wordpress.com/2011/09/03/expanding-listview-items/
This is pretty much the case. If you need more information, just ask.
source share