Define Android animation without using xml
How can I define this animation xml by java code without using xml
<set xmlns:android="http://schemas.android.com/apk/res/an开发者_运维知识库droid"
android:interpolator="@android:anim/accelerate_interpolator">
<translate android:fromXDelta="-100%p" android:toXDelta="0"
android:duration="900" />
</set>
Yes, why not ?
AnimationSet set = new AnimationSet( true );
Animation translate = new TranslateAnimation( -100, 0, 0, 0);
translate.setDuration( 900 );
set.addAnimation( translate );
Regards, Stéphane
精彩评论