我有一个在屏幕上移动的imageview。所以,我已经设置了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();
}
答案 0 :(得分:0)
我在xml文件中找到了答案:android:adjustViewBounds =“true”。但是,我仍然不知道为什么android正在调整我的观点。这是一个谜!