Voora Tarun
Voora Tarun

Reputation: 1216

Check a child view visible on screen or not in NestedScrollview

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 .

Upvotes: 0

Views: 4297

Answers (1)

Andrii Usik
Andrii Usik

Reputation: 166

You can use next code:

Rect mReact = new Rect();
scrollView.getHitRect(mReact);
if (mView.getLocalVisibleRect(mReact)) {
// visible
} else {
// invisible
}

Upvotes: 15

Related Questions