Android animation jumps to end -
hi trying simple listview
expand animation
work. animation
working jumps end resumes animation
.
this code animation class:
public class dropdownanimation extends animation { private int targetheight; private view view; private boolean down; public dropdownanimation(view view, int targetheight, boolean down) { this.view = view; this.targetheight = targetheight; this.down = down; } public dropdownanimation(view view, int targetheight) { this.view = view; this.targetheight = targetheight; this.setduration(350); if(view.getvisibility() == view.invisible) down = true; else down = false; } @override protected void applytransformation(float interpolatedtime, transformation t) { super.applytransformation(interpolatedtime,t); int newheight; if (down) { newheight = (int) (targetheight * interpolatedtime); view.setvisibility(view.visible); } else { newheight = (int) (targetheight * (1 - interpolatedtime)); view.setvisibility(view.invisible); } view.getlayoutparams().height = newheight; view.requestlayout(); } @override public void initialize(int width, int height, int parentwidth, int parentheight) { super.initialize(width, height, parentwidth, parentheight); } @override public boolean willchangebounds() { return true; } }
animation
being called this:
dropdownanimation dropdownanimation = new dropdownanimation(toolbar,expandedheight); toolbar.startanimation(dropdownanimation); view parent = (view)test.getparent(); parent.invalidate();
Comments
Post a Comment