问题描述
我有一个AnimationSet与ScaleAnimation内,像这样的TranslateAnimation:
I have an AnimationSet with inside a ScaleAnimation and a TranslateAnimation like this:
TranslateAnimation:
TranslateAnimation:
TranslateAnimation goTopFromRight =
new TranslateAnimation(0, -(right.getLeft()-top.getLeft()),
0,-(right.getTop()-top.getTop()));
ScaleAnimation:
ScaleAnimation:
ScaleAnimation = setSizeForTop = new ScaleAnimation(1, 2, 1, 2);
和AnimationSet:
and AnimationSet:
bringToLeftFromTopAnimationSet = new AnimationSet(true);
bringToTopFromRightAnimationSet.addAnimation(goTopFromRight);
bringToTopFromRightAnimationSet.addAnimation(setSizeForTop);
现在的问题是,当我尝试只使用ScaleAnimation,我的项目去我想要的位置,但磨片我现在用的是ScaleAnimation与在AnimationSet的TranslateAnimation,我的产品转化比我更需要,因为如果ScaleAnimation介绍了一些辅助动作ABD我不知道如何删除它们。
The problem is that when i try to use only the ScaleAnimation, my item goes to the position i want, but whe I am using the ScaleAnimation with the TranslateAnimation in the AnimationSet, my item translates more than i need, as if ScaleAnimation introduces some supplementary movements abd I don't know how to delete them.
感谢您的帮助。
推荐答案
要使用ScaleAnimation和TranslateAnimation时避免ScaleAnimation运动,你必须与那些来自ScaleAnimation这样乘以TranslateAnimation参数应用:
To avoid the ScaleAnimation movement when using the ScaleAnimation and TranslateAnimation, you have to multiply the TranslateAnimation parametres with those from ScaleAnimation like this:
TranslateAnimation goRightFromTop;
ScaleAnimation sizeNotUp;
goRightFromTop = new TranslateAnimation(0,(-( invisibleCenterImageView.getLeft() - imageViewRight.getLeft() ))*(1/0.6667f), 0, (-( invisibleCenterImageView.getTop() - imageViewRight.getTop()))*(1/0.6667f));
sizeNotUp = new ScaleAnimation(1,0.6667f,1,0.6667f,Animation.RELATIVE_TO_SELF, (float)0.5, Animation.RELATIVE_TO_SELF, (float)0.5);
然后,会让你大吃一惊删除ScaleAnimation运动。
And then, surprise you deleted the ScaleAnimation movement.
这篇关于Android的ScaleAnimation和TranslateAnimation,如何避免ScaleAnimation运动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!