Android AbsoluteLayout ImageView.getLayoutParams()返回x和y的零值
在按钮单击事件中,我设置了图像按钮的x和y值,单击另一个按钮后,我希望通过添加其值(如Android AbsoluteLayout ImageView.getLayoutParams()返回x和y的零值,android,layoutparams,absolutelayout,Android,Layoutparams,Absolutelayout,在按钮单击事件中,我设置了图像按钮的x和y值,单击另一个按钮后,我希望通过添加其值(如x=x+10)再次更改其坐标,但layoutParams.y在设置前几秒钟返回0 AbsoluteLayout.LayoutParams lp = new AbsoluteLayout.LayoutParams(hand.getLayoutParams()); Log.d("mangala",String.format("b pos %d", lp.y ));
x=x+10
)再次更改其坐标,但layoutParams.y
在设置前几秒钟返回0
AbsoluteLayout.LayoutParams lp = new AbsoluteLayout.LayoutParams(hand.getLayoutParams());
Log.d("mangala",String.format("b pos %d", lp.y ));
lp.y = lp.y - g.convertDPtoPX(30f);
Log.d("mangala",String.format("a pos %d", lp.y ));
hand.setLayoutParams(lp);
谢谢。AbsoluteLayout已被弃用,不建议使用。是的,我知道我正在询问有关LayoutParams的问题。我很确定这与LinearLayout参数的边距值有相同的用法。