NestedScrollView extends FrameLayout implements NestedScrollingParent2,
        NestedScrollingChild2, ScrollingView { @RestrictTo(LIBRARY_GROUP) @Override public int computeVerticalScrollRange() { final int count = getChildCount(); final int parentSpace = getHeight() - getPaddingBottom() - getPaddingTop(); if (count == 0) { return parentSpace; } View child = getChildAt(0); NestedScrollView.LayoutParams lp = (LayoutParams) child.getLayoutParams(); int scrollRange = child.getBottom() + lp.bottomMargin; final int scrollY = getScrollY(); final int overscrollBottom = Math.max(0, scrollRange - parentSpace); if (scrollY < 0) { scrollRange -= scrollY; } else if (scrollY > overscrollBottom) { scrollRange += scrollY - overscrollBottom; } return scrollRange; } NestedScrollView(@NonNull Context context);  NestedScrollView(@NonNull Context context, @Nullable AttributeSet attrs);  NestedScrollView(@NonNull Context context, @Nullable AttributeSet attrs,
                            int defStyleAttr); @Override boolean startNestedScroll(int axes, int type); @Override void stopNestedScroll(int type); @Override boolean hasNestedScrollingParent(int type); @Override boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed,
                                        int dyUnconsumed, int[] offsetInWindow, int type); @Override boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow,
                                           int type); @Override void setNestedScrollingEnabled(boolean enabled); @Override boolean isNestedScrollingEnabled(); @Override boolean startNestedScroll(int axes); @Override void stopNestedScroll(); @Override boolean hasNestedScrollingParent(); @Override boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed,
                                        int dyUnconsumed, int[] offsetInWindow); @Override boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow); @Override boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed); @Override boolean dispatchNestedPreFling(float velocityX, float velocityY); @Override boolean onStartNestedScroll(@NonNull View child, @NonNull View target, int axes,
                                       int type); @Override void onNestedScrollAccepted(@NonNull View child, @NonNull View target, int axes,
                                       int type); @Override void onStopNestedScroll(@NonNull View target, int type); @Override void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed,
                               int dyUnconsumed, int type); @Override void onNestedPreScroll(@NonNull View target, int dx, int dy, @NonNull int[] consumed,
                                  int type); @Override boolean onStartNestedScroll(View child, View target, int nestedScrollAxes); @Override void onNestedScrollAccepted(View child, View target, int nestedScrollAxes); @Override void onStopNestedScroll(View target); @Override void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed,
                               int dyUnconsumed); @Override void onNestedPreScroll(View target, int dx, int dy, int[] consumed); @Override boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed); @Override boolean onNestedPreFling(View target, float velocityX, float velocityY); @Override int getNestedScrollAxes(); @Override boolean shouldDelayChildPressedState(); int getMaxScrollAmount(); @Override void addView(View child); @Override void addView(View child, int index); @Override void addView(View child, ViewGroup.LayoutParams params); @Override void addView(View child, int index, ViewGroup.LayoutParams params); void setOnScrollChangeListener(@Nullable OnScrollChangeListener l); boolean isFillViewport(); void setFillViewport(boolean fillViewport); boolean isSmoothScrollingEnabled(); void setSmoothScrollingEnabled(boolean smoothScrollingEnabled); @Override boolean dispatchKeyEvent(KeyEvent event); boolean executeKeyEvent(@NonNull KeyEvent event); @Override void requestDisallowInterceptTouchEvent(boolean disallowIntercept); @Override boolean onInterceptTouchEvent(MotionEvent ev); @Override boolean onTouchEvent(MotionEvent ev); @Override boolean onGenericMotionEvent(MotionEvent event); boolean pageScroll(int direction); boolean fullScroll(int direction); boolean arrowScroll(int direction); final void smoothScrollBy(int dx, int dy); final void smoothScrollTo(int x, int y); @RestrictTo(LIBRARY_GROUP) @Override int computeVerticalScrollRange(); @RestrictTo(LIBRARY_GROUP) @Override int computeVerticalScrollOffset(); @RestrictTo(LIBRARY_GROUP) @Override int computeVerticalScrollExtent(); @RestrictTo(LIBRARY_GROUP) @Override int computeHorizontalScrollRange(); @RestrictTo(LIBRARY_GROUP) @Override int computeHorizontalScrollOffset(); @RestrictTo(LIBRARY_GROUP) @Override int computeHorizontalScrollExtent(); @Override void computeScroll(); @Override void requestChildFocus(View child, View focused); @Override boolean requestChildRectangleOnScreen(View child, Rect rectangle,
                                                 boolean immediate); @Override void requestLayout(); @Override void onAttachedToWindow(); void fling(int velocityY); @Override void scrollTo(int x, int y); @Override void draw(Canvas canvas);  }
@Test public void computeVerticalScrollRange_takesAccountOfMargin() { setup(200); setChildMargins(20, 30); measureAndLayout(100); int actual = mNestedScrollView.computeVerticalScrollRange(); assertThat(actual, is(250)); }