0

In my activity, I have a long scrollview contains multiple views, when a user is scrolling up or down, I have to check whether a textview is visible or not on screen.

Please help me .

Voora Tarun
  • 1,266
  • 1
  • 20
  • 38
  • 1
    Possible duplicate of [Android: how to check if a View inside of ScrollView is visible?](http://stackoverflow.com/questions/4628800/android-how-to-check-if-a-view-inside-of-scrollview-is-visible) – Ishita Sinha Aug 04 '16 at 13:37

1 Answers1

13

You can use next code:

Rect mReact = new Rect();
scrollView.getHitRect(mReact);
if (mView.getLocalVisibleRect(mReact)) {
// visible
} else {
// invisible
}
Andrii Usik
  • 146
  • 1
  • 6