You are reading 12.8.0. See this page in 13.4.1.
Titanium.UI.ScrollView
Extends Titanium.UI.ViewTitanium.Proxy
A view that contains a horizontally and/or vertically-scrollable region of content.
Use the Titanium.UI.createScrollView method or <ScrollView> Alloy element to create a scroll view.
Views added to the scroll view will be scrolled based on the size of the scrollable region of content. If a scrollable region fits within the size of its scroll view, the view will not scroll.
Android Platform Notes
On Android, a scroll view can only scroll in one direction, either vertically or horizontally,
and not both at the same time. The Titanium.UI.ScrollView.scrollType property sets the scroll
direction explicitly. If the scrollType property is not assigned a value, the scroll view
attempts to determine the scroll direction based on some the following rules:
-
If Titanium.UI.ScrollView.contentWidth and Titanium.UI.ScrollView.width are both set and are equal to each other, or if they are both set and
showVerticalScrollIndicatoris set totrue, then the scroll direction is set to "vertical". -
If Titanium.UI.ScrollView.contentHeight and Titanium.UI.ScrollView.height are both set and are equal, or if they are both set and Titanium.UI.ScrollView.showHorizontalScrollIndicator is set to
true, then the scroll direction is set to "horizontal".
Pinching a ScrollableView to zoom in and out of content is not supported on Android. On iOS, this action
is natively supported by the UIScrollView class, but on Android, the native ScrollView class does
not support this action.
Examples
Simple Scroll View
Create a scroll view with content.
var win = Ti.UI.createWindow({
exitOnClose: true,
fullscreen: false,
title: 'ScrollView Demo'
});
var scrollView = Ti.UI.createScrollView({
showVerticalScrollIndicator: true,
showHorizontalScrollIndicator: true,
height: '80%',
width: '80%'
});
var view = Ti.UI.createView({
backgroundColor:'#336699',
borderRadius: 10,
top: 10,
height: 2000,
width: 1000
});
scrollView.add(view);
win.add(scrollView);
win.open();
Scroll View as a Table View
Create a scroll view that contains a set of views in a layout to resemble a table view with rows. This approach can mitigate the native Android issue described in the "TextFields in Tables with SOFT_INPUT_ADJUST_PAN" section of <Titanium.UI.TableView>.
var win = Ti.UI.createWindow();
if (Ti.UI.Android){
win.windowSoftInputMode = Ti.UI.Android.SOFT_INPUT_ADJUST_PAN;
}
function createRow(i) {
var row = Ti.UI.createView({
backgroundColor: 'white',
borderColor: '#bbb',
borderWidth: 1,
width:'100%', height: 70,
top: 0, left: 0
});
var inputTextField = Ti.UI.createTextField({
hintText: 'Enter value ' + i,
keyboardType: Ti.UI.KEYBOARD_NUMBERS_PUNCTUATION,
top: 10, left: '10%',
width: '80%', height: 60
});
row.add(inputTextField);
return row;
}
var scrollView = Ti.UI.createScrollView({
bottom:120,
layout: 'vertical'
});
for(var i = 0; i <= 20; i++){
var row = createRow(i);
scrollView.add(row);
}
win.add(scrollView);
var label = Ti.UI.createLabel({
backgroundColor:'darkgray',
text: 'Your advert here',
textAlign: 'center',
bottom:0,
width: Titanium.UI.FILL,
height:100
});
win.add(label);
win.open();
Alloy XML Markup
Previous simple scroll view example as an Alloy view.
<Alloy>
<Window id="win" backgroundColor="white" exitOnClose="true" fullscreen="false" title="ScrollView Demo">
<ScrollView id="scrollView" showVerticalScrollIndicator="true" showHorizontalScrollIndicator="true" height="80%" width="80%">
<View id="view" backgroundColor="#336699" borderRadius="10" top="10" height="2000" width="1000" />
</ScrollView>
</Window>
</Alloy>
Properties 91
Inherited from Titanium.UI.View
Boolean value to remove the long press notification for the device's accessibility service.
Default: true
Inherited from Titanium.UI.View
Whether the view should be "hidden" from (i.e., ignored by) the accessibility service.
Default: false
Inherited from Titanium.UI.View
Briefly describes what performing an action (such as a click) on the view will do.
Default: null
Inherited from Titanium.UI.View
A succint label identifying the view for the device's accessibility service.
Inherited from Titanium.UI.View
A string describing the value (if any) of the view for the device's accessibility service.
Inherited from Titanium.UI.View
Coordinate of the view about which to pivot an animation.
Inherited from Titanium.UI.View
Current position of the view during an animation.
Inherited from Titanium.Proxy
The name of the API that this proxy corresponds to.
backgroundColor
String | Titanium.UI.ColorInherited from Titanium.UI.View
Background color of the view, as a color name or hex triplet.
Inherited from Titanium.UI.View
Disabled background color of the view, as a color name or hex triplet.
Inherited from Titanium.UI.View
Disabled background image for the view, specified as a local file path or URL.
Inherited from Titanium.UI.View
Focused background color of the view, as a color name or hex triplet.
Inherited from Titanium.UI.View
Focused background image for the view, specified as a local file path or URL.
Inherited from Titanium.UI.View
A background gradient for the view.
Linear and Radial Gradients
The following code excerpt creates two views, one with a linear gradient and one with a radial gradient.
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff',
layout: 'vertical'
});
var radialGradient = Ti.UI.createView({
top: 10,
width: 100,
height: 100,
backgroundGradient: {
type: 'radial',
startPoint: { x: 50, y: 50 },
endPoint: { x: 50, y: 50 },
colors: [ 'red', 'blue'],
startRadius: 50,
endRadius: 0,
backfillStart: true
}
});
var linearGradient = Ti.UI.createView({
top: 10,
width: 100,
height: 100,
backgroundGradient: {
type: 'linear',
startPoint: { x: '0%', y: '50%' },
endPoint: { x: '100%', y: '50%' },
colors: [ { color: 'red', offset: 0.0}, { color: 'blue', offset: 0.25 }, { color: 'red', offset: 1.0 } ],
}
});
win1.add(radialGradient);
win1.add(linearGradient);
win1.open();
backgroundImage
StringInherited from Titanium.UI.View
Background image for the view, specified as a local file path or URL.
Inherited from Titanium.UI.View
Size of the left end cap.
Default: 0
backgroundRepeat
BooleanInherited from Titanium.UI.View
Determines whether to tile a background across a view.
Default: false
Inherited from Titanium.UI.View
Selected background color of the view, as a color name or hex triplet.
Inherited from Titanium.UI.View
Selected background image url for the view, specified as a local file path or URL.
Inherited from Titanium.UI.View
Size of the top end cap.
Default: 0
borderColor
String | Titanium.UI.ColorInherited from Titanium.UI.View
Border color of the view, as a color name or hex triplet.
borderRadius
Number | String | Array<Number> | Array<String>Inherited from Titanium.UI.View
Radius for the rounded corners of the view's border.
Default: 0
borderWidth
NumberInherited from Titanium.UI.View
Border width of the view.
Default: 0
bottom
Number | StringInherited from Titanium.UI.View
View's bottom position, in platform-specific units.
Inherited from Titanium.Proxy
Indicates if the proxy will bubble an event to its parent.
Default: true
canCancelEvents
BooleanDetermines whether this scroll view can cancel subview touches in order to scroll instead.
On iOS, this property maps to the native canCancelContentTouches property which controls
whether touches in the content view always lead to tracking. See UIScrollView for more details.
On Android, setting this property to false prevents the scroll view from intercepting any touch events from its subviews. Note that this behavior may be slightly different from iOS.
Default: true
Inherited from Titanium.UI.View
View's center position, in the parent view's coordinates.
Inherited from Titanium.UI.View
Array of this view's child views.
Inherited from Titanium.UI.View
View's clipping behavior.
contentHeight
Number | StringHeight of the scrollable region.
While absolute dimensions are supported, relative values, such as those provided in percentages, are not. The minimum value for contentHeight is the height of the scroll view. Measured in platform-specific units; pixels on Android, effective pixels on Windows and density-independent pixels (dip) on iOS.
X and Y coordinates to which to reposition the top-left point of the scrollable region.
On iOS, a new value causes the scroll view to perform an animated scroll to the new offset. The Titanium.UI.ScrollView.setContentOffset method can be used to prevent this animation.
contentWidth
Number | StringWidth of the scrollable region.
While absolute dimensions are supported, relative values, such as those provided in percentages, are not. The minimum value for contentWidth is the width of the scroll view. Measured in platform-specific units; pixels on Android, effective pixels on Windows and density-independent pixels (dip) on iOS.
The deceleration rate of the ScrollView.
Default: Undefined.
Determines whether scroll bounce of the scrollable region is enabled.
Set to true to disable horizontal and vertical bounce.
This property takes precedence over the horizontalBounce and verticalBounce properties.
Default: false
Inherited from Titanium.UI.View
Base elevation of the view relative to its parent in pixels.
Inherited from Titanium.UI.View
Discards touch related events if another app's system overlay covers the view.
Default: false
Inherited from Titanium.UI.View
Whether view should be focusable while navigating with the trackball.
Default: false
height
Number | StringInherited from Titanium.UI.View
View height, in platform-specific units.
Determines whether horizontal scroll bounce of the scrollable region is enabled.
With the default value of true, dragging in the horizontal direction is always allowed and
also bounces.
Set to false to disable horizontal scroll bounce if the horizontal content is smaller than
the scroll view bounds. However, larger content will still bounce when scrolled.
Note that the disableBounce property takes precedence over the horizontalBounce and
verticalBounce properties.
Default: true
Inherited from Titanium.UI.View
Adds a horizontal parallax effect to the view
Inherited from Titanium.UI.View
Determines whether the layout has wrapping behavior.
Default: true
id
StringInherited from Titanium.UI.View
View's identifier.
Inherited from Titanium.UI.View
Determines whether to keep the device screen on.
Default: false
The manner in which the keyboard is dismissed when a drag begins in the scroll view.
Default: Undefined (behaves like Titanium.UI.iOS.KEYBOARD_DISMISS_MODE_NONE)
layout
StringInherited from Titanium.UI.View
Specifies how the view positions its children. One of: 'composite', 'vertical', or 'horizontal'.
left
Number | StringInherited from Titanium.UI.View
View's left position, in platform-specific units.
Inherited from Titanium.Proxy
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
Maximum scaling factor of the scrollable region and its content.
This value determines how large the content can be scaled. It must be greater than the minimum zoom scale for zooming to be enabled. The default value is 1.0 unless otherwise specified.
Note that specifying a value less than or equal to 0 will hide all contents of the scroll view.
Default: 1
Minimum scaling factor of the scrollable region and its content.
This value determines how small the content can be scaled. It must be less than the maximum zoom scale for zooming to be enabled. The default value is 1.0 unless otherwise specified.
Default: 1
opacity
NumberInherited from Titanium.UI.View
Opacity of this view, from 0.0 (transparent) to 1.0 (opaque). Defaults to 1.0 (opaque).
Inherited from Titanium.UI.View
When on, animate call overrides current animation if applicable.
Determines the behavior when the user overscolls the view.
Default: Titanium.UI.Android.OVER_SCROLL_ALWAYS
Inherited from Titanium.UI.View
The preview context used in the 3D-Touch feature "Peek and Pop".
Inherited from Titanium.UI.View
Background color of the wrapper view when this view is used as either Titanium.UI.ListView.pullView or Titanium.UI.TableView.headerPullView.
Defaults to undefined. Results in a light grey background color on the wrapper view.
Inherited from Titanium.UI.View
The bounding box of the view relative to its parent, in system units.
View positioned above the first row that is only revealed when the user drags the scroll view contents down.
An alternate to the pullView property. See Titanium.UI.RefreshControl for usage and examples. Since Titanium SDK 7.5.0, the RefreshControl API is also available on iOS < 10.
right
Number | StringInherited from Titanium.UI.View
View's right position, in platform-specific units.
Inherited from Titanium.UI.View
Clockwise 2D rotation of the view in degrees.
Inherited from Titanium.UI.View
Clockwise rotation of the view in degrees (x-axis).
Inherited from Titanium.UI.View
Clockwise rotation of the view in degrees (y-axis).
Inherited from Titanium.UI.View
Scaling of the view in x-axis in pixels.
Inherited from Titanium.UI.View
Scaling of the view in y-axis in pixels.
Style of the scrollbar.
Default: Titanium.UI.iOS.ScrollIndicatorStyle.DEFAULT
Determines whether scrolling is enabled for the view.
Default: true
Controls whether the scroll-to-top gesture is effective.
The scroll-to-top gesture is a tap on the status bar; The default value of this property is true. This gesture works when you have a single visible scroll view. If there are multiple table views, web views, text areas, and/or scroll views visible, you will need to disable (set to false) on the above views that you don't want this behaviour on. The remaining view will then respond to scroll-to-top gesture.
Default: true
Limits the direction of the scrollable region, overriding the deduced setting. Set to
horizontal or vertical.
See the scrollView description for more details about how the scroll direction is deduced when this property is not defined.
Determines whether the horizontal scroll indicator is visible.
Set to true to show the horizontal scroll indicator.
Default: false
showVerticalScrollIndicator
BooleanDetermines whether the vertical scroll indicator is visible.
Set to true to show the vertical scroll indicator.
Default: false
Inherited from Titanium.UI.View
The size of the view in system units.
Inherited from Titanium.UI.View
Determines keyboard behavior when this view is focused. Defaults to Titanium.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS.
Inherited from Titanium.UI.View
The view's tintColor
Default: null
Inherited from Titanium.UI.View
The default text to display in the control's tooltip.
top
Number | StringInherited from Titanium.UI.View
The view's top position.
touchEnabled
BooleanInherited from Titanium.UI.View
Determines whether view should receive touch events.
Default: true
Inherited from Titanium.UI.View
A material design visual construct that provides an instantaneous visual confirmation of touch point.
Default: false
Inherited from Titanium.UI.View
Optional touch feedback ripple color. This has no effect unless touchFeedback is true.
Inherited from Titanium.UI.View
Transformation matrix to apply to the view.
Default: Identity matrix
Inherited from Titanium.UI.View
A name to identify this view in activity transition.
Inherited from Titanium.UI.View
Horizontal location of the view relative to its left position in pixels.
Inherited from Titanium.UI.View
Vertical location of the view relative to its top position in pixels.
Inherited from Titanium.UI.View
Depth of the view relative to its elevation in pixels.
Determines whether vertical scroll bounce of the scrollable region is enabled.
With the default value of true, dragging in the vertical direction is always allowed and
also bounces.
Set to false to disable vertical scroll bounce if the vertical content is smaller than
the scroll view bounds. However, larger content will still bounce when scrolled.
Note that the disableBounce property takes precedence over the horizontalBounce and
verticalBounce properties.
Default: true
Inherited from Titanium.UI.View
Adds a vertical parallax effect to the view
viewShadowColor
String | Titanium.UI.Colorsince Android 11.1.0, iPhone 3.3.0, iPad 3.3.0, macOS 9.2.0Inherited from Titanium.UI.View
Determines the color of the shadow.
Inherited from Titanium.UI.View
Determines the offset for the shadow of the view.
Inherited from Titanium.UI.View
Determines the blur radius used to create the shadow.
visible
BooleanInherited from Titanium.UI.View
Determines whether the view is visible.
Default: true
width
Number | StringInherited from Titanium.UI.View
View's width, in platform-specific units.
zIndex
NumberInherited from Titanium.UI.View
Z-index stack order position, relative to other sibling views.
Scaling factor of the scroll view's content.
This value is bound by the minZoomScale and maxZoomScale properties.
Default: 1
Methods 22
Inherited from Titanium.UI.View
Adds a child to this view's hierarchy.
| Parameters | Type | Description |
|---|---|---|
| view | Titanium.UI.View | Array<Titanium.UI.View> | View to add to this view's hierarchy. You may pass an array of views, e.g. |
Inherited from Titanium.Proxy
Adds the specified callback as an event listener for the named event.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| callback | Callback<Titanium.Event> | Callback function to invoke when the event is fired. 4 fields
|
Inherited from Titanium.UI.View
Animates this view.
| Parameters | Type | Description |
|---|---|---|
| animation | Titanium.UI.Animation | Dictionary<Titanium.UI.Animation> | Either a dictionary of animation properties or an Animation object. |
| callback? | Callback<Object> | Function to be invoked upon completion of the animation. |
applyProperties
since 3.0.0Inherited from Titanium.Proxy
Applies the properties to the proxy.
| Parameters | Type | Description |
|---|---|---|
| props | Dictionary | A dictionary of properties to apply. |
Inherited from Titanium.UI.View
Removes all previously added motion effects.
convertPointToView
since Android 1.8, iPhone 1.8, iPad 1.8, macOS 9.2.0Inherited from Titanium.UI.View
Translates a point from this view's coordinate system to another view's coordinate system.
| Parameters | Type | Description |
|---|---|---|
| point | Point | A point in this view's coordinate system. If this argument is missing an |
| destinationView | Titanium.UI.View | View that specifies the destination coordinate system to convert to. If this argument is not a view, an exception will be raised. |
Inherited from Titanium.Proxy
Fires a synthesized event to any registered listeners.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| event? | Dictionary | A dictionary of keys and values to add to the Titanium.Event object sent to the listeners. |
getViewById
since 6.1.0Inherited from Titanium.UI.View
Returns the matching view of a given view ID.
| Parameters | Type | Description |
|---|---|---|
| id | String | The ID of the view that should be returned. Use the |
Inherited from Titanium.UI.View
Hides this view.
| Parameters | Type | Description |
|---|---|---|
| options? | AnimatedOptions | Animation options for Android only. Since SDK 5.1.0 and used only on Android 5.0+ Determines whether to enable a circular reveal animation.
Note that the default here is equivalent to passing in |
insertAt
since 3.3.0Inherited from Titanium.UI.View
Inserts a view at the specified position in the children array.
| Parameters | Type | Description |
|---|---|---|
| params | ViewPositionOptions | Pass an object that specifies the view to insert and optionally at which position (defaults to end) 2 fields
|
Inherited from Titanium.UI.View
Removes a child view from this view's hierarchy.
| Parameters | Type | Description |
|---|---|---|
| view | Titanium.UI.View | View to remove from this view's hierarchy. |
removeAllChildren
since 3.1.0Inherited from Titanium.UI.View
Removes all child views from this view's hierarchy.
Inherited from Titanium.Proxy
Removes the specified callback as an event listener for the named event.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| callback | Callback<Titanium.Event> | Callback function to remove. Must be the same function passed to 4 fields
|
replaceAt
since 3.3.0Inherited from Titanium.UI.View
Replaces a view at the specified position in the children array.
| Parameters | Type | Description |
|---|---|---|
| params | ViewPositionOptions | Pass an object with the view to insert and the position of the view to replace. In this case the 2 fields
|
Moves the specified coordinate of the scrollable region into the viewable area.
| Parameters | Type | Description |
|---|---|---|
| x | Number | X coordinate from the scrollable region's coordinate system. |
| y | Number | Y coordinate from the scrollable region's coordinate system. |
| options? | AnimatedOptions | A simple object for specifying the animation properties when scrolling the view (since SDK 6.1.0).
When set to Note that the default here is equivalent to passing in |
scrollToBottom
since 2.1.0Moves the end of the scrollable region into the viewable area.
On Android the behavior of scrollToBottom depends on whether this scroll view scrolls
horizontally or vertically. For vertical scroll views, scrollToBottom moves the bottom
of the scrollable region into the viewable area. For horizontal scroll views,
scrollToBottom moves the rightmost edge of of the scrollable region into the viewable area.
On iOS, scrollToBottom moves the bottom-right corner of the scrollable region into the
viewable area.
scrollToTop
since 7.0.0Moves the top of the scrollable region into the viewable area.
On Android the behavior of scrollToTop depends on whether this scroll view scrolls
horizontally or vertically. For vertical scroll views, scrollToTop moves the top
of the scrollable region into the viewable area. For horizontal scroll views,
scrollToTop moves the leftmost edge of of the scrollable region into the viewable area.
On iOS, scrollToTop moves the top-left corner of the scrollable region into the
viewable area.
setContentOffset
iPhoneiPadmacOSSets the value of the contentOffset property.
| Parameters | Type | Description |
|---|---|---|
| contentOffsetXY | Point | X and Y coordinates to which to reposition the top-left point of the scrollable region. |
| animated? | AnimatedOptions | A JS object with an Note that the default here is equivalent to passing in |
setZoomScale
iPhoneiPadmacOSSets the value of the zoomScale property.
| Parameters | Type | Description |
|---|---|---|
| zoomScale | Number | Scaling factor of the scroll view's content. |
| options? | AnimatedOptions | A JS object with an Note that the default here is equivalent to passing in |
Inherited from Titanium.UI.View
Makes this view visible.
| Parameters | Type | Description |
|---|---|---|
| options? | AnimatedOptions | Animation options for Android only. Since SDK 5.1.0 and only used on Android 5.0+ Determines whether to enable a circular reveal animation.
Note that the default here is equivalent to passing in |
Inherited from Titanium.UI.View
Stops a running animation.
Inherited from Titanium.UI.View
Returns an image of the rendered view, as a Blob.
| Parameters | Type | Description |
|---|---|---|
| callback? | Callback<Titanium.Blob> | Function to be invoked upon completion. If non-null, this method will be performed asynchronously. If null, it will be performed immediately. |
| honorScaleFactor? | Boolean | Determines whether the image is scaled based on scale factor of main screen. (iOS only) When set to true, image is scale factor is honored. When set to false, the image in the blob has the same dimensions for retina and non-retina devices. |
Events 23
Inherited from Titanium.UI.View
Fired when the device detects a click against the view.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
Inherited from Titanium.UI.View
Fired when the device detects a double click against the view.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
Inherited from Titanium.UI.View
Fired when the device detects a double tap against the view.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
dragend
since iPhone 3.0.0, iPad 3.0.0, Android 6.2.0Fired when the scrollable region stops being dragged.
A dragging gesture is when a touch remains in contact with the display to physically drag the view, as opposed to it being the result of scrolling momentum.
| Event properties | Type | Description |
|---|---|---|
| decelerate | Boolean | Indicates whether scrolling will continue but decelerate, now that the drag gesture has
been released by the touch. If |
| x | Number | X coordinate from the scrollable touch position. |
| y | Number | Y coordinate from the scrollable touch position. |
dragEnd
iPhoneiPadmacOSFired when the scrollable region stops being dragged.
This event has been deprecated and renamed dragend (lower case).
A dragging gesture is when a touch remains in contact with the display to physically drag the view, as opposed to it being the result of scrolling momentum.
| Event properties | Type | Description |
|---|---|---|
| decelerate | Boolean | Indicates whether scrolling will continue but decelerate, now that the drag gesture has
been released by the touch. If |
dragstart
since iPhone 3.0.0, iPad 3.0.0, Android 6.2.0Fired when the scrollable region starts being dragged.
A dragging gesture is when a touch remains in contact with the display to physically drag the view, as opposed to it being the result of scrolling momentum.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate from the scrollable touch position. |
| y | Number | Y coordinate from the scrollable touch position. |
dragStart
iPhoneiPadmacOSFired when the scrollable region starts being dragged.
This event has been deprecated and renamed dragstart (lower case).
A dragging gesture is when a touch remains in contact with the display to physically drag the view, as opposed to it being the result of scrolling momentum.
focus
AndroidInherited from Titanium.UI.View
Fired when the view element gains focus.
keypressed
since Android 3.1.0, iPhone 5.4.0, iPad 5.4.0, macOS 9.2.0Inherited from Titanium.UI.View
Fired when a hardware key is pressed in the view.
| Event properties | Type | Description |
|---|---|---|
| keyCode | Number | The code for the physical key that was pressed. For more details, see KeyEvent. This API is experimental and subject to change. |
longclick
AndroidInherited from Titanium.UI.View
Fired when the device detects a long click.
Inherited from Titanium.UI.View
Fired when the device detects a long press.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
pinch
since 1.8.0Inherited from Titanium.UI.View
Fired when the device detects a pinch gesture.
| Event properties | Type | Description |
|---|---|---|
| scale | Number | The scale factor relative to the points of the two touches in screen coordinates. |
| velocity | Number | The velocity of the pinch in scale factor per second. |
| time | Number | The event time of the current event being processed. |
| timeDelta | Number | The time difference in milliseconds between the previous accepted scaling event and the current scaling event. |
| currentSpan | Number | The average distance between each of the pointers forming the gesture in progress through the focal point. |
| currentSpanX | Number | The average X distance between each of the pointers forming the gesture in progress through the focal point. |
| currentSpanY | Number | The average Y distance between each of the pointers forming the gesture in progress through the focal point. |
| previousSpan | Number | The previous average distance between each of the pointers forming the gesture in progress through the focal point. |
| previousSpanX | Number | The previous average X distance between each of the pointers forming the gesture in progress through the focal point. |
| previousSpanY | Number | The previous average Y distance between each of the pointers forming the gesture in progress through the focal point. |
| focusX | Number | The X coordinate of the current gesture's focal point. |
| focusY | Number | The Y coordinate of the current gesture's focal point. |
| inProgress | Boolean | Returns |
postlayout
since 2.0.0Inherited from Titanium.UI.View
Fired when a layout cycle is finished.
rotate
since 12.7.0Inherited from Titanium.UI.View
Fired when the device detects a two finger rotation.
| Event properties | Type | Description |
|---|---|---|
| rotate | Number | Rotation in degrees. |
scale
iPhoneiPadmacOSFired when the zoom scale factor changes.
| Event properties | Type | Description |
|---|---|---|
| scale | Number | New scaling factor as a float. |
Fired when the scrollable region is scrolled.
| Event properties | Type | Description |
|---|---|---|
| contentSize | Size | The current content size of the scroll view defined by its |
| decelerating | Boolean | Indicates whether the scroll is decelerating. |
| dragging | Boolean | Indicates whether the event was fired during a dragging gesture, where the touch remained in contact with the display to physically drag the view, as opposed to it being the result of scrolling momentum. |
| zooming | Boolean | Indicates whether the event was fired during a zooming operation. This is only available from Release 3.2.3 of the Titanium Mobile SDK. |
| curZoomScale | Number | The current scaling factor of the scroll view content. This might not be equal to
the |
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
Inherited from Titanium.UI.View
Fired when the device detects a single tap against the view.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
Inherited from Titanium.UI.View
Fired when the device detects a swipe gesture against the view.
| Event properties | Type | Description |
|---|---|---|
| direction | String | Direction of the swipe--either 'left', 'right', 'up', or 'down'. |
| x | Number | X coordinate of the event's endpoint from the |
| y | Number | Y coordinate of the event's endpoint from the |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
Inherited from Titanium.UI.View
Fired when a touch event is interrupted by the device.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| force | Number | The current force value of the touch event. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices. |
| size | Number | The current size of the touch area. Note: This property is only available on some Android devices. |
| maximumPossibleForce | Number | Maximum possible value of the force property. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. |
| altitudeAngle | Number | A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0. Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later. |
| timestamp | Number | The time (in seconds) when the touch was used in correlation with the system start up. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. |
| azimuthUnitVectorInViewX | Number | The x value of the unit vector that points in the direction of the azimuth of the stylus. Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. |
| azimuthUnitVectorInViewY | Number | The y value of the unit vector that points in the direction of the azimuth of the stylus. Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
Inherited from Titanium.UI.View
Fired when a touch event is completed.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| force | Number | The current force value of the touch event. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices. |
| size | Number | The current size of the touch area. Note: This property is only available on some Android devices. |
| maximumPossibleForce | Number | Maximum possible value of the force property. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. |
| altitudeAngle | Number | A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0. Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later. |
| timestamp | Number | The time (in seconds) when the touch was used in correlation with the system start up. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. |
| azimuthUnitVectorInViewX | Number | The x value of the unit vector that points in the direction of the azimuth of the stylus. Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. |
| azimuthUnitVectorInViewY | Number | The y value of the unit vector that points in the direction of the azimuth of the stylus. Note: This property is only available for iOS devices that support the Apple Penciland are 9.1 or later. |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
Inherited from Titanium.UI.View
Fired as soon as the device detects movement of a touch.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| force | Number | The current force value of the touch event. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices. |
| size | Number | The current size of the touch area. Note: This property is only available on some Android devices. |
| maximumPossibleForce | Number | Maximum possible value of the force property. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. |
| altitudeAngle | Number | A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0. Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later. |
| timestamp | Number | The time (in seconds) when the touch was used in correlation with the system start up. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. |
| azimuthUnitVectorInViewX | Number | The x value of the unit vector that points in the direction of the azimuth of the stylus. Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. |
| azimuthUnitVectorInViewY | Number | The y value of the unit vector that points in the direction of the azimuth of the stylus. Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
Inherited from Titanium.UI.View
Fired as soon as the device detects a touch gesture.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| force | Number | The current force value of the touch event. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices. |
| size | Number | The current size of the touch area. Note: This property is only available on some Android devices. |
| maximumPossibleForce | Number | Maximum possible value of the force property. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. |
| altitudeAngle | Number | A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0. Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later. |
| timestamp | Number | The time (in seconds) when the touch was used in correlation with the system start up. Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. |
| azimuthUnitVectorInViewX | Number | The x value of the unit vector that points in the direction of the azimuth of the stylus. Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. |
| azimuthUnitVectorInViewY | Number | The y value of the unit vector that points in the direction of the azimuth of the stylus. Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |
twofingertap
since 3.0.0Inherited from Titanium.UI.View
Fired when the device detects a two-finger tap against the view.
| Event properties | Type | Description |
|---|---|---|
| x | Number | X coordinate of the event from the |
| y | Number | Y coordinate of the event from the |
| obscured | Boolean | Returns This is a security feature to protect an app from "tapjacking", where a malicious app can use a system overlay to intercept touch events in your app or to trick the end-user to tap on UI in your app intended for the overlay. |