Avoid items from ViewTree onScrollChanged()

72 views Asked by At

I am using ViewTreeObserver.OnScrollChangedListener to determine when ScrollView bottom has been reached.

Here is my layout:

<ScrollView>

 <RelativeLayout>

  <FrameLayout>//use as a banner       
  </FrameLayout>

  <RelativeLayout>//there are some other views inside this layout
  </RelativeLayout>

 </RelativeLayout>

</ScrollView>

I am programatically adding a ViewPager to FrameLayout in ScrollView and it has timer to change the page periodically.

Since

onScrollChanged() is a callback method to be invoked when something in the view tree has been scrolled.

onScrollChanged() is calling every time when ViewPager's page changed.

I ONLY need to work onScrollChanged() when I scrolling the ScrollView. Is there anyway to achieve this?

PS: I can't put FrameLayout(ViewPager) outside of the ScrollView.

0

There are 0 answers