我有一个在屏幕上移动的图像视图。所以,我已经设置了 LayoutParams 来做到这一点。但是,android 坚持要调整我的 imageview 的大小。如何防止这种行为?
public void move(int x, int y)
{
width = this.getWidth();
height = this.getHeight();
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(WIDTH, HEIGHT);
int t = validateMin(calcTopPos(y));
int l = validateMin(calcLeftPos(x));
int r = validateMaxWidth(calcRightPos(x))-1;
int b = validateMaxHeight(calcBottomPos(y));
params.setMargins(l, t, r, b);
this.setLayoutParams(params);
requestLayout();
}