开发者

Define Android animation without using xml

开发者 https://www.devze.com 2023-03-09 18:46 出处:网络
How can I define this animation xml by java code without using xml <set xmlns:android=\"http://schemas.android.com/apk/res/an开发者_运维知识库droid\"

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

精彩评论

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