0
小问题,在你使用TranslateAnimation之后的android中,你如何获得它所拍摄的位置。在动画结束后获取布局的新位置
在我的应用程序中,当用户触摸图像时,它会向上移动并显示输入屏幕。 但是当图像达到最终位置时,我想将图像粘贴到新的位置。 但是,当我使用getHeight或getLayoutParams我总是得到旧的位置。
public void moveProducts() {
float addAmmountY = -250;
TranslateAnimation anim = new TranslateAnimation(0,0,0,addAmmountY); //(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta)
anim.setDuration(1000);
final LinearLayout product_buttons = (LinearLayout)findViewById(R.id.product_buttons);
anim.setAnimationListener(new TranslateAnimation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
//TODO set new location of the linearlayout
}
});
product_buttons.startAnimation(anim);
}