我想通過翻譯動畫將圖像按鈕翻譯到另一個位置(位置到另一個圖像按鈕)。我有他們的兩個職位。我擁有的動畫方法都是使用相對位置變化,但我對絕對翻譯感興趣。在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
是的,我想要兩個職位之間的絕對翻譯。幫我。 –
對我來說它不起作用 –