MobileUI
/
ScrollView
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.
Usage
A ScrollView for a large amount of text
<ScrollView width="fill_parent" height="fill_parent">
<TextView text="#{hugeAmountOfText}" width="fill_parent" />
</ScrollView>
A ScrollView for a book chapter
<ScrollView width="fill_parent" height="fill_parent">
<LinearLayout orientation="vertical" width="fill_parent">
<TextView text="#{chapterTitle}" width="fill_parent" backgroundColor="green"/>
<TextView text="#{chapterContent}" width="fill_parent" />
<TextView text="#{footerText}" width="fill_parent" backgroundColor="darkgray"/>
</LinearLayout>
</ScrollView>
Children
One View
or Layout
.
Attributes
Name | Type | Default | Binding | Description |
---|---|---|---|---|
Inherits all attributes from FrameLayout and adds no attributes. |
Parts of this documentation are a derivate of the Android Developer Documentation by Google used under CC-BY-2.5.