我想在xml和代码中制作相同的动画。 我编码我有这个
Animation a = new TranslateAnimation(Animation.RELATIVE_TO_PARENT , 1.1f, Animation.RELATIVE_TO_PARENT, -0.2f,
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f);
我从我的xml anim文件开始,但我不知道如何让他知道翻译应该是相对于父级的
<translate
android:duration="2500"
android:fromXDelta="-0.1"
android:fromYDelta="0"
android:toXDelta="200"
android:toYDelta="0" />
即我不知道如何指定fromXType属性
fromXType指定如何解释fromXValue。 Animation.ABSOLUTE,Animation.RELATIVE_TO_SELF或Animation.RELATIVE_TO_PARENT之一。