I struggled a lot to get an accurate answer and th following solved my problem
final ScrollView scrollView = findViewById(R.id.scrollView);
scrollView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
@Override
public void onScrollChanged() {
Rect scrollBounds = new Rect();
scrollView.getHitRect(scrollBounds);
if (yourImageView.getLocalVisibleRect(scrollBounds)) {
// The ImageView is Visible on the screen while scrolling
} else {
// The ImageView is not Visible on the screen while scrolling
}
}
});
The code within the OnScrollChangedListener keeps checking if the Imageview is visible and shown on the screen and once you scroll and the imageview is not visible it gets detected immediately