private void scrollTo(final int listIndex) {
        final int realIndex = Math.max(0, Math.min(adapter.getItemCount() - 1, listIndex));
        final RecyclerView recyclerView = binding.imagegalleryList;
        final GridLayoutManager layoutManager = (GridLayoutManager) recyclerView.getLayoutManager();
        //check if item is already (completely) visible --> then don't scroll
        final View viewAtPosition = layoutManager.findViewByPosition(realIndex);
        if (viewAtPosition == null || layoutManager
                .isViewPartiallyVisible(viewAtPosition, false, true)) {

            //view is either not or only partially visible --> scroll

            int offset = 50; //default
            //try to calculate an offset such that the image to scroll to ends up in the middle of the gallery view
            final int imageHeight = ViewUtils.dpToPixel(IMAGE_TARGET_HEIGHT_DP);
            final int height = this.getHeight();
            if (height >= imageHeight) {
                offset = (height - imageHeight) / 2;
            }

            //use "scrollToPositionWithOffset" since "scrollToPosition" behaves strange -> see issue #13586
            layoutManager.scrollToPositionWithOffset(realIndex, offset);
        }
    }
scrolls the image gallery to the list index given
main/src/main/java/cgeo/geocaching/ui/ImageGalleryView.java