title: How to calculate speed of recyclerView inside NestedScrollView in Android
body: <p>I have recyclerView inside NestedScrollView. I want to calculate speed to recyclerview but it is not working inside nestedScrollView.</p>
  <p>This is code to calculate scroll speed which is working without NestedScrollView. I want to make it work with NestedScrollView also.</p>
  <p>I have set nested scrolling false but its not working</p>
  <pre><code>recyclerView.setNestedScrollingEnabled(false)
  </code></pre>
  <p>Class:</p>
  <pre><code>abstract class ScrollSpeedRecycleViewScrollListener(private val maxScrollSpeedForAdInjection: Int) :
      RecyclerView.OnScrollListener() {
  
    
      var currentScrollSpeed: Int = 0
  
      private var previousFirstVisibleItem = 0
      private var previousEventTime: Long = 0
  
      override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
          super.onScrolled(recyclerView, dx, dy)
  
          val layoutManager = recyclerView.layoutManager
  
          if (layoutManager is LinearLayoutManager) {
              val firstItemPosition = layoutManager.findFirstVisibleItemPosition()
  
              if (previousFirstVisibleItem != firstItemPosition) {
                
              }
          }
      }
  
      override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
          super.onScrollStateChanged(recyclerView, newState)
  
          when (newState) {
              RecyclerView.SCROLL_STATE_IDLE -&gt; {
                  if (currentScrollSpeed &gt; maxScrollSpeedForAdInjection) {
                      listNeedsRefresh()
                  }
                  currentScrollSpeed = 0
              }
          }
      }
  
  }
  </code></pre>