开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜