Stay organized with collections Save and categorize content based on your preferences.
added in version 22.1.0
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1

NestedScrollView

public class NestedScrollView
extends FrameLayout implements NestedScrollingParent, NestedScrollingChild2, ScrollingView

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ android.support.v4.widget.NestedScrollView


NestedScrollView is just like ScrollView, but it supports acting as both a nested scrolling parent and child on both new and old versions of Android. Nested scrolling is enabled by default.

Summary

Nested classes

interface NestedScrollView.OnScrollChangeListener

Interface definition for a callback to be invoked when the scroll X or Y positions of a view change. 

Inherited constants

From class android.view.ViewGroup
From class android.view.View

Inherited fields

From class android.view.View

Public constructors

NestedScrollView(Context context)
NestedScrollView(Context context, AttributeSet attrs)
NestedScrollView(Context context, AttributeSet attrs, int defStyleAttr)

Public methods

void addView(View child, int index)
void addView(View child, ViewGroup.LayoutParams params)
void addView(View child, int index, ViewGroup.LayoutParams params)
void addView(View child)
boolean arrowScroll(int direction)

Handle scrolling in response to an up or down arrow click.

void computeScroll()
boolean dispatchKeyEvent(KeyEvent event)
boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed)
boolean dispatchNestedPreFling(float velocityX, float velocityY)
boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow)
boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow, int type)

Dispatch one step of a nested scroll in progress before this view consumes any portion of it.

boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow, int type)

Dispatch one step of a nested scroll in progress.

boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow)
void draw(Canvas canvas)
boolean executeKeyEvent(KeyEvent event)

You can call this function yourself to have the scroll view perform scrolling from a key event, just as if the event had been dispatched to it by the view hierarchy.

void fling(int velocityY)

Fling the scroll view

boolean fullScroll(int direction)

Handles scrolling in response to a "home/end" shortcut press.

int getMaxScrollAmount()
int getNestedScrollAxes()
boolean hasNestedScrollingParent()
boolean hasNestedScrollingParent(int type)

Returns true if this view has a nested scrolling parent for the given input type.

boolean isFillViewport()

Indicates whether this ScrollView's content is stretched to fill the viewport.

boolean isNestedScrollingEnabled()
boolean isSmoothScrollingEnabled()
void onAttachedToWindow()
boolean onGenericMotionEvent(MotionEvent event)
boolean onInterceptTouchEvent(MotionEvent ev)
boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed)
boolean onNestedPreFling(View target, float velocityX, float velocityY)
void onNestedPreScroll(View target, int dx, int dy, int[] consumed)
void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed)
void onNestedScrollAccepted(View child, View target, int nestedScrollAxes)
boolean onStartNestedScroll(View child, View target, int nestedScrollAxes)
void onStopNestedScroll(View target)
boolean onTouchEvent(MotionEvent ev)
boolean pageScroll(int direction)

Handles scrolling in response to a "page up/down" shortcut press.

void requestChildFocus(