android - ImageView animate -
i have problem animation. wrote code, nothing happens.
public void animate(view v){ imageview img = (imageview) findviewbyid(r.id.imageview); img.animate().translationyby(-1000f).setduration(300); }
i using android studio 2.2.2
try may you
public void slidetoy() { animation slide = null; slide = new translateanimation(animation.relative_to_self, 0.0f, animation.relative_to_self, 0.0f, animation.relative_to_self, -5.0f, animation.relative_to_self, 0.0f); slide.setduration(2000); slide.setfillafter(true); slide.setfillenabled(true); img.startanimation(slide); slide.setanimationlistener(new animation.animationlistener() { @override public void onanimationstart(animation animation) { } @override public void onanimationrepeat(animation animation) { } @override public void onanimationend(animation animation) { } }); }
Comments
Post a Comment