| Platform | Since |
|---|---|
| Android | 0.9 |
| iPhone | 0.9 |
| iPad | 0.9 |
| Mobile Web | 0.9 |
A Scroll View is used to create a scrollable region of content.
Views added to the Scroll View will be scrolled based on the content size of the
Scroll View. The Scroll View is created by the method Titanium.UI.createScrollView.
If your scrollable region fits within the size of the content area the scroll view will not scroll.
In Android, Scroll Views can only scroll in one direction, either vertical
or horizontal, but not both at the same time. Use the Titanium.UI.ScrollView.scrollType
property to set the scroll direction explicitly.
If the scrollType property is not set, the scroll view
attempts to deduce the scroll direction based on some of the other
properties that have been set. Specifically, if contentWidth and width
are both set and are equal to each other, or if they are both set and
showVerticalScrollIndicator is set to true, then the scroll direction
is set to "vertical". If contentHeight and height are both set and are
equal, or if they are both set and showHorizontalScrollIndicator is set
to true, then the scroll direction is set to "horizontal". If
scrollType is set, it overrides the deduced setting.
Create a scroll view with content.
var scrollView = Titanium.UI.createScrollView({ contentWidth:'auto', contentHeight:'auto', top:0, showVerticalScrollIndicator:true, showHorizontalScrollIndicator:true }); var view = Ti.UI.createView({ backgroundColor:'#336699', borderRadius:10, width:300, height:2000, top:10 }); scrollView.add(view); Titanium.UI.currentWindow.add(scrollView);
| Name | Summary |
|---|---|
| add |
Adds a child to this view's hierarchy. |
| addEventListener |
Adds the specified callback as an event listener for the named event. |
| animate |
Animates this view. |
| convertPointToView |
Translates a point from this view's coordinate system to another view's coordinate system. (Android, iPhone, iPad only.) |
| fireEvent |
Fires a synthesized event to any registered listeners. |
| hide |
Hides this view. |
| remove |
Removes a child view from this view's hierarchy. |
| removeEventListener |
Removes the specified callback as an event listener for the named event. |
| scrollTo |
scrollTo a particular point |
| show |
Makes this view visible. |
| toImage |
Returns an image of the rendered view, as a Blob. (Android, iPhone, iPad only.) |
| Name | Type | Summary |
|---|---|---|
| anchorPoint | Point |
Anchor point where animation should occur, relative to the view's boundaries. (iPhone, iPad only.) |
| animatedCenterPoint | Point |
Current position of the view during an animation. (Android, iPhone, iPad only.) read-only |
| backgroundColor | String |
Background color of the view. |
| backgroundDisabledColor | String |
Disabled background color of the view. (Android only.) |
| backgroundDisabledImage | String |
Disabled background image for the view, specified as a local file path or URL. (Android only.) |
| backgroundFocusedColor | String |
Focused background color of the view. (Android only.) |
| backgroundFocusedImage | String |
Focused background image for the view, specified as a local file path or URL. (Android only.) |
| backgroundGradient | Gradient |
A background gradient for the view. (iPhone, iPad, Mobile Web only.) |
| backgroundImage | String |
Background image for the view, specified as a local file path or URL. |
| backgroundLeftCap | Number |
Size of the left end cap. (iPhone, iPad only.) |
| backgroundSelectedColor | String |
Selected background color of the view. (Android, Mobile Web only.) |
| backgroundSelectedImage | String |
Selected background image url for the view, specified as a local file path or URL. (Android, Mobile Web only.) |
| backgroundTopCap | Number |
Size of the top end cap. (iPhone, iPad only.) |
| borderColor | String |
Border color of the view. |
| borderRadius | Number |
Border radius of the view. |
| borderWidth | Number |
Border width of the view. |
| bottom | Number or String |
View's bottom position, in platform-specific units. |
| canCancelEvents | Boolean |
boolean to indicate if the scroll view can cancel subview touches in order to scroll instead. Default of true (iPhone, iPad, Mobile Web only.) |
| center | Point |
View's center position, in the parent view's coordinates. |
| contentHeight | Number |
the height of the scrollable area |
| contentOffset | Object |
an object (with x and y properties) to indicate the offset of the content area |
| contentWidth | Number |
the width of the scrollable area |
| disableBounce | Boolean |
disable view bouncing. (iPhone, iPad only.) |
| focusable | Boolean |
Whether view should be focusable while navigating with the trackball. (Android only.) |
| height | Number or String |
View height, in platform-specific units. |
| horizontalBounce | Boolean |
boolean to control the horizontal bounce during scrolling (iPhone, iPad only.) |
| keepScreenOn | Boolean |
Whether to keep the device screen on. (Android only.) |
| layout | String |
Specifies how the view positions its children. One of: 'absolute', 'vertical', or 'horizontal'. |
| left | Number or String |
View's left position, in platform-specific units. |
| maxZoomScale | Number |
the maximum scale of the content (iPhone, iPad only.) |
| minZoomScale | Number |
the minimum scale of the content (iPhone, iPad only.) |
| opacity | Number |
Opacity of this view, from 0.0 (transparent) to 1.0 (opaque). |
| right | Number or String |
View's right position, in platform-specific units. |
| scrollType | String |
For explicitly setting the direction -- "vertical" or "horizontal" -- in which the ScrollView will scroll. See also the documentation notes for more information concerning how Android deduces the scroll direction when this property is not set. (Android only.) |
| showHorizontalScrollIndicator | Boolean |
boolean to indicate whether the horizontal scroll indicator is visible |
| showVerticalScrollIndicator | Boolean |
boolean to indicate whether the vertical scroll indicator is visible |
| size | Object |
Size of the view as a dictionary of width and height properties. |
| softKeyboardOnFocus | Number |
Determines keyboard behavior when this view is focused. (Android only.) |
| top | Number or String |
The view's top position. |
| touchEnabled | Boolean |
Whether view should receive touch events. |
| transform | Object |
Transformation matrix to apply to the view. (Android, iPhone, iPad only.) |
| verticalBounce | Boolean |
boolean to control the vertical bounce during scrolling (iPhone, iPad only.) |
| visible | Boolean |
Boolean value indicating whether the view is visible. |
| width | Number or String |
View's width, in platform-specific units. |
| zIndex | Number |
the z index position relative to other sibling views |
| zoomScale | Number |
set the zoom scale for the current content area (iPhone, iPad only.) |
| Name | Summary |
|---|---|
| click |
Fired when the device detects a click against the view. |
| dblclick |
Fired when the device detects a double click against the view. |
| doubletap |
Fired when the device detects a double tap against the view. (Android, iPhone, iPad only.) |
| dragEnd |
fired when when dragging ended in the scroll view. (iPhone, iPad only.) |
| dragStart |
fired when the scroll view is about to start scrolling the content. (iPhone, iPad only.) |
| longclick |
Fired when the device detects a long click. (Android only.) |
| longpress |
Fired when the device detects a long press. (Android, iPhone, iPad only.) |
| pinch |
Fired when the device detects a pinch gesture. |
| scale |
fired when the zoom scale factor changes (Android, iPhone, iPad only.) |
| scroll |
fired when the view is scrolled |
| singletap |
Fired when the device detects a single tap against the view. |
| swipe |
Fired when the device detects a swipe gesture (left or right) against the view. (iPhone, iPad, Mobile Web only.) |
| touchcancel |
Fired when a touch event is interrupted by the device. |
| touchend |
Fired when a touch event is completed. |
| touchmove |
Fired as soon as the device detects movement of a touch. |
| touchstart |
Fired as soon as the device detects a touch gesture. |
| twofingertap |
Fired when the device detects a two-finger tap against the view. |