int findCenterViewIndex(){
  int count=getChildCount();
  int index=RecyclerView.NO_POSITION;
  int closest=Integer.MAX_VALUE;
  int centerY=getCenterYPos();
  for (int i=0; i < count; ++i) {
    View child=getChildAt(i);
    int childCenterY=mTicklableRecyclerView.getTop() + ViewPropertiesHelper.getCenterYPos(child);
    int distance=Math.abs(centerY - childCenterY);
    if (distance < closest) {
      closest=distance;
      index=i;
    }
  }
  if (index == RecyclerView.NO_POSITION) {
    throw new IllegalStateException("Can\'t find central view.");
  }
 else {
    return index;
  }
}

int findCenterViewIndex ( ) { int count = getChildCount ( ) ; int index = RecyclerView . NO_POSITION ; int closest = Integer . MAX_VALUE ; int centerY = getCenterYPos ( ) ; for ( int i = 0 ; i < count ; ++ i ) { View child = getChildAt ( i ) ; int childCenterY = mTicklableRecyclerView . getTop ( ) + ViewPropertiesHelper . getCenterYPos ( child ) ; int distance = Math . abs ( centerY - childCenterY ) ; if ( distance < closest ) { closest = distance ; index = i ; } } if ( index == RecyclerView . NO_POSITION ) { throw new IllegalStateException ( "Can\'t find central view." ) ; } else { return index ; } }
find a view closest to center , return its index ( relative the children views )
