ImageView를 움직여 화면을 움직이게했지만 애니메이션이 끝나면 (화면에서 벗어난 것처럼 보이게하기 위해) 보이지 않게하려고합니다.ImageView를 Android에서 움직이게 한 후에 ImageView를 보이지 않게 만드는 방법
translate.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
button.setText("Animation Started");
}
@Override
public void onAnimationEnd(Animation animation) {
brickimg.setVisibility(View.GONE);//This should make the ImageView invisible
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
그러나, 애니메이션이 끝나지 않아 :
이
내가 노력 코드입니다. AnimationStart에 붙어있어이 경우에 발생하는 유일한 작업은 버튼의 텍스트가 변경된다는 것입니다. 애니메이션을 끝내는 방법을 아는 사람이 있습니까? 그렇지 않으면 애니메이션이 끝난 후 ImageView가 보이지 않게됩니다. 이것은 당신이 애니메이션의 어떤 종류의 일을하고 있습니다에 따라 당신은 AnimationEnd에 투명 이미지를 설정할 수 있습니다int x=brickimg.getRight()-brickimg.getLeft();
int y=brickimg.getBottom()-brickimg.getTop();
final TranslateAnimation translate = new TranslateAnimation(
Animation.ABSOLUTE,1000, Animation.ABSOLUTE,
x, Animation.ABSOLUTE,0,
Animation.ABSOLUTE,y);//How far it goes on the axis. The first x goes left, second x goes right, first y goes up, second goes down
translate.setDuration(300);//speed of the animation
translate.setFillEnabled(true);
translate.setFillAfter(true);
brickimg.startAnimation(translate);
your_animation.setRepeatCount (0); ? –
이 링크를 참조 할 수도 있습니다. http://stackoverflow.com/questions/19921968/how-to-hide-images-after-animation-end-in-android – Minp
번역 애니메이션의 다른 속성이있는 코드를 공유 할 수 있습니까? 설정? –