请给我样本移动图像到我的保证金目的地
插图
image x (margin move image)
如果拖动图像移动图像停止移动到我的边缘
imageView.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
int eid = event.getAction();
switch (eid) {
case MotionEvent.ACTION_MOVE:
RelativeLayout.LayoutParams mParams = (RelativeLayout.LayoutParams) imageView.getLayoutParams();
int x = (int) event.getRawX();
//int y = (int) event.getRawY();
TextView text = (TextView) findViewById(R.id.editText1);
text.setText("1");
mParams.setMargins(0, 0, 70, 0);
mParams.leftMargin = x+0;
//mParams.
imageView.setLayoutParams(mParams);
break;
default:
break;
}
return true;
}
}