如何控制TranslateAnimation滑动方向?

时间:2012-12-19 07:45:04

标签: android translate-animation

showaction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
             Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
             -1.0f, Animation.RELATIVE_TO_SELF, 0.0f);
             showaction.setDuration(500);

此方法参数效果是垂直向下滑动,现在我想从左到右滑动它。怎么做?

1 个答案:

答案 0 :(得分:0)

showaction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, -1.0f,
             Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
             0.0f, Animation.RELATIVE_TO_SELF, 0.0f);
             showaction.setDuration(500);

来自docs