번역 애니메이션을 통해 이미지 단추를 다른 위치 (다른 이미지 단추 위치)로 변환하려고합니다. 나는 둘 다 지위가있다. 애니메이션 방법은 모두 상대 위치 변경을 사용하지만 절대 변환에 관심이 있습니다. 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
예 두 위치간에 절대 변환이 필요합니다. 도와주세요. 나를 위해 –
가 작동하지 않습니다 –