The problem was that the shadows were DropShadowFrameLayoutalways drawn in a fixed position:
private Rect getDropShadowArea(Canvas canvas, Bitmap bm) {
return new Rect(0, 0, canvas.getWidth(), bm.getHeight());
}
ViewPagerit turned out that it uses its internal coordinates, so the solution was to set up this method to know the current scroll position ViewPager(I use Y instead of X, because I actually use it VerticalViewPager, but the principle is the same for both):
private Rect getDropShadowArea(Canvas canvas, Bitmap bm) {
return new Rect(0, getScrollY(), canvas.getWidth(),
getScrollY() + bm.getHeight());
}
canvas getScrollY() , ( pskink).
() , dispatchDraw() Bitmap.