How do swipe or scrollIntoView with collapsing toolbar


I am implementing my automated testing for Android and when I try to use the method swipe() or scrollIntoView(), these methods don’t work when the collapsing toolbar from the screen is collapse (see image 2). Could anyone help me?

Image 1: The method swipe or scrollIntoView works

Image 2: The method swipe or scrollIntoView don’t work: