Android animation why is it delayed by duration -
i have simple translate animation in xml
anim.xml
<translate xmlns:... android:fromydelta="100%p" android:toydelta="0%p" android:duration="1500" />
and use slide layout bottom of screen:
view layoutstatus = activity.findviewbyid(r.id.layoutsettingsstatus); layoutstatus.setvisibility(view.visible); animation = animationutils.loadanimation(context, r.anim.slide_up); layoutstatus.startanimation(a);
but doesn't start until 1500ms (or possibly longer) after code executed. when change anim duration 1500 5000, doesn't execute until 5 seconds after code executed. duration property working, takes long translate start.
its android:duration applying android:startoffset, why this?
from snippets cant why happens, need more code. check class viewpropertyanimator, can make life , code easier in future. example of using in case :
layoutstatus.animate().translationy(toy).setduration(1500); // toy float , takes coordinates on screen
all need in 1 line of code, simple can get. class contains available methods setstartdelay(), setinterpolator(), setlistener() etc... there differences between translateanimation , viewpropertyanimation/objectanimation explained here.
Comments
Post a Comment