我想通过翻译动画将图像按钮翻译到另一个位置(位置到另一个图像按钮)。我有他们的两个职位。我拥有的动画方法都是使用相对位置变化,但我对绝对翻译感兴趣。在Android中有没有办法做到这一点?动画无法正常工作?
public void startAnimationFindChant(View view) {
int[] locationSource = new int[2];
int[] locationDestination = new int[2];
view.geLocationOnScreen(locationSource);
Log.d("locationSource",locationSource[0]+" "+locationSource[1]);
ImageButton findachant1 = (ImageButton) findViewById(R.id.findachanticon1);
findachant1.getLocationOnScreen(locationDestination);
Log.d("locationDestination",locationDestination[0]+" "+locationDestination[1]);
TranslateAnimation animation = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0,
Animation.ABSOLUTE, locationSource[1], Animation.ABSOLUTE,
locationDestination[1]);
animation.setFillAfter(true);
view.startAnimation(animation);
}
我想OP询问了两个职位之间的绝对翻译。 – noob
是的,我想要两个职位之间的绝对翻译。帮我。 –
对我来说它不起作用 –