Android Guides | Samples

Android.Widget.ScrollView Class

Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display.

See Also: ScrollView

Syntax

[Android.Runtime.Register("android/widget/ScrollView", DoNotGenerateAcw=true)]
public class ScrollView : FrameLayout

Remarks

Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display. A ScrollView is a FrameLayout, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objects. A child that is often used is a LinearLayout in a vertical orientation, presenting a vertical array of top-level items that the user can scroll through.

You should never use a ScrollView with a ListView, because ListView takes care of its own vertical scrolling. Most importantly, doing this defeats all of the important optimizations in ListView for dealing with large lists, since it effectively forces the ListView to display its entire list of items to fill up the infinite container supplied by ScrollView.

The TextView class also takes care of its own scrolling, so does not require a ScrollView, but using the two together is possible to achieve the effect of a text view within a larger container.

ScrollView only supports vertical scrolling. For horizontal scrolling, use HorizontalScrollView.

[Android Documentation]

Requirements

Namespace: Android.Widget
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Widget.ScrollView are listed below.

See Also: FrameLayout

Public Constructors

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Properties

FillViewportBoolean. Indicates whether this ScrollView's content is stretched to fill the viewport.
[read-only]
MaxScrollAmountInt32.
SmoothScrollingEnabledBoolean.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

ArrowScroll(FocusSearchDirection) : Boolean
Handle scrolling in response to an up or down arrow click.
ExecuteKeyEvent(KeyEvent) : Boolean
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.
Fling(Int32)
Fling the scroll view
FullScroll(FocusSearchDirection) : Boolean
PageScroll(FocusSearchDirection) : Boolean
SmoothScrollBy(Int32, Int32)
Like View.ScrollBy(Int32,Int32), but scroll smoothly instead of immediately.
SmoothScrollTo(Int32, Int32)
Like ScrollView.scrollTo(int, int), but scroll smoothly instead of immediately.

Protected Methods

ComputeScrollDeltaToGetChildRectOnScreen(Rect) : Int32
Compute the amount to scroll in the Y direction in order to get a rectangle completely on the screen (or, if taller than the screen, at least the first screen size chunk of it).