Android 开发实例:图片拖动的实现(java)
2010-02-03 16:32:00 来源:WEB开发网核心提示:// 否则跳过if (clickPic) {// picWidth与picHeight分别除以2,定位击中点为图片的中心picX = paramsIv_1.x = (int) (x - picWidth / 2);// 限制图片在屏幕坚向的移动范围if (y >= 350)y = 350;picY = param
// 否则跳过
if (clickPic) {
// picWidth与picHeight分别除以2,定位击中点为图片的中心
picX = paramsIv_1.x = (int) (x - picWidth / 2);
// 限制图片在屏幕坚向的移动范围
if (y >= 350)
y = 350;
picY = paramsIv_1.y = (int) (y - picHeight / 2);
iv_1.setLayoutParams(paramsIv_1);
str3 = "Anjoy: picWidth = " + picWidth + ", picHeight = "
+ picHeight + ", picX = " + picX + ", picY = " + picY;
Log.i("move", str3);
tv_3.setText(str3);
}
break;
}
return super.onTouchEvent(event);
}
}
更多精彩
赞助商链接