我正在努力寻找中心孩子,但每次我执行下面的检查,其他部分都会被执行,我不知道为什么......哦,顺便说一句,我正在尝试编辑3dcoursel
if (childCenter >= galleryCenter)///check if the image is in the centre
{Log.i("HOLA///", " you are awesome");
}
else {
Log.i("HOLA///", " you too are awesome ");
}
galleryCenter = getCenterOfGallery();
childCenter = getCenterOfView(child);
private static int getCenterOfView(View view) {
return view.getLeft() + view.getWidth() / 2;
}
private int getCenterOfGallery() {
return (getWidth() - Carousel.this.getPaddingLeft() - Carousel.this.getPaddingRight()) / 2 +
Carousel.this.getPaddingLeft();
}