How to apply Scale animation After Translate animation in android -
hi doing 1 app here need apply rotate,move scale animation imageview..i tried using below code rotate , scale animation working in scale animation image not scaling in translate animation stoped postion coming original postion there scaling..but need scale image image stoped using translate animation..where did mistake 1 suggest me thanks
public class mainactivity extends activity { imageview i1; translateanimation movelefttoright1; animation logomoveanimation; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); i1=(imageview)findviewbyid(r.id.img); final animation myrotation = animationutils.loadanimation(getapplicationcontext(), r.anim.rotate1); i1.startanimation(myrotation); movelefttoright1 = new translateanimation(0, 0, 0, 200); movelefttoright1.setduration(2000); movelefttoright1.setfillafter(true); myrotation.setanimationlistener(new animation.animationlistener() { @override public void onanimationstart(animation animation) { } @override public void onanimationend(animation animation) { i1.startanimation(movelefttoright1); } @override public void onanimationrepeat(animation animation) { } }); logomoveanimation = animationutils.loadanimation(this, r.anim.sacle); movelefttoright1.setanimationlistener(new animation.animationlistener() { @override public void onanimationstart(animation animation) { } @override public void onanimationend(animation animation) { i1.startanimation(logomoveanimation); } @override public void onanimationrepeat(animation animation) { } }); } }
scale.xml:
<scale xmlns:android="http://schemas.android.com/apk/res/android" android:fromxscale="0.5" android:toxscale="2.0" android:fromyscale="0.5" android:toyscale="2.0" android:pivotx="0%" android:pivoty="100%" android:startoffset="0" android:duration="1000" android:fillafter="true" />
rotate.xml
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:shareinterpolator="false"> <rotate android:fromdegrees="0" android:todegrees="360" android:pivotx="50%" android:pivoty="50%" android:startoffset="0" android:duration="3000"/> </set>
u may try after translation has finished img.settranslation(value); value = position image should after translation
Comments
Post a Comment