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>
精彩评论