我正在创建一个Android应用程序.我在这里有一个imageview.我的目标是在图像上移动手指时从数据库中获取下一张图片
float nPicturePositionM = 0;
public boolean onTouch(View v, MotionEvent event) {
boolean aHandledL = false;
if (event.getAction() == MotionEvent.ACTION_MOVE) {
float nNewPicturePosL = event.getX();
if (nPicturePositionM < nNewPicturePosL) {
nPicturePositionM = nNewPicturePosL;
GetPictures(true);
} else {
nPicturePositionM = nNewPicturePosL;
GetPictures(false);
}
aHandledL = true;
}
return aHandledL;
//return false;
}
Run Code Online (Sandbox Code Playgroud)
我如何使用触摸事件处理它?图像应该像我们在图库中那样滑动
android ×1