开发者

Defining XML animation to match programmatic definition

开发者 https://www.devze.com 2023-03-15 15:41 出处:网络
I am trying to replicate this Animation from code to XML form. This example is take from http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx. for example, I have the java code:

I am trying to replicate this Animation from code to XML form. This example is take from http://www.codeproject.com/KB/android/ViewFlipper_Animation.aspx. for example, I have the java code:

Animation inFromRight = new TranslateAnimation(
    Animation.RELATIVE_TO_PARENT, +1.0f, 
    Anima开发者_C百科tion.RELATIVE_TO_PARENT, 0.0f, 
    Animation.RELATIVE_TO_PARENT, 0.0f, 
    Animation.RELATIVE_TO_PARENT, 0.0f);
inFromRight.setDuration(350);
inFromRight.setInterpolator(new AccelerateInterpolator());

To try and define this under my /res/anim/in_from_right.xml file, I tried something like the following but it didn't work.

<set xmlns:android="http://schema.android.com/apk/res/android" 
    android:interpolator="@android:anim/accelerate_interpolator">
    <translate android:fromXDelta="100%p" android:toXDelta="0" 
               android:fromYDelta="0" android:toYDelta="0" android:duration="350"/>
</set>
0

精彩评论

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