更新时间:2023-01-26 15:02:56
这是因为动画会影响部件的只是图纸。然而,真正的位置不受影响 - 它仍然是在previous 1 -
This is because Animations affects only the drawing of widget. However, The real Location is not affected -It is still in the previous one-.
要解决这个问题,你需要手动通过安装监听器的动画更新的ImageView的布局参数如下:
To overcome this problem, you need to update the layout parameters of the ImageView manually by installing an animation listener as follows:
Animation.setAnimationListener(new AnimationListener() {
public void onAnimationStart(Animation arg0) {
}
public void onAnimationRepeat(Animation arg0) {
//TODO Auto-generated method stub
}
public void onAnimationEnd(Animation arg0) {
android.widget.LinearLayout.LayoutParams params = new LayoutParams(
android.widget.LinearLayout.LayoutParams.FILL_PARENT,
android.widget.LinearLayout.LayoutParams.WRAP_CONTENT);
params.topMargin = addLocationButton.getTop()-100;
ImageView.setLayoutParams(params);
}
});