Add Delete Item animation to Android ListView
Adding a folding animation to the ListView when you delete an item will feel better.
The step is to delete a view, first using the animation to change the height of the view, it looks like a folding effect. When the animation is finished, the item is actually removed.
private void Deletepattern (final view view, final int position) {Animation.animationlistener Al = new Animatio N.animationlistener () {@Override public void Onanimationstart (Animation Animation) {} @Override public void Onanimationend (Animation Animation) {Mdbhelper.deletecustompatt Ern (Mpatternlist.get (position)); Mpatternlist.remove (position); Mpatternadapter.notifydatasetchanged (); } @Override public void Onanimationrepeat (Animation Animation) {}}; Collapse (view, AL); private void collapse (final view view, Animation.animationlistener al) {final int originheight = View.getmeas Uredheight (); Animation Animation = new Animation () {@Override protected void applytransformation (float Interpola Tedtime, transformation t) {if (Interpolatedtime = = 1.0f) { View.setvisibility (View.gone); } else {view.getlayoutparams (). Height = originheight-(int) (originheight * interpolatedtime); View.requestlayout (); }} @Override public boolean willchangebounds () {return true; } }; if (Al! = null) {Animation.setanimationlistener (AL); } animation.setduration (300); View.startanimation (animation); }
Add Delete Item animation to Android ListView