You are reading 13.3.0. See this page in 13.4.1.
Titanium.UI.Android.Snackbar
Extends Titanium.UI.ViewTitanium.Proxy
Snackbars provide brief messages about app processes at the bottom of the screen.
| Android |
|---|
![]() |
For design guidelines, see Material design: Snackbars
Examples
Show a Snackbar
Display a Snackbar with an action button.
const win = Ti.UI.createWindow();
const btn = Ti.UI.createButton({
title: 'show message'
});
btn.addEventListener('click', function() {
snack.show();
});
const snack = Ti.UI.Android.createSnackbar({
message: 'Hello Snackbar!',
length: Ti.UI.Android.Snackbar.LENGTH_INDEFINITE,
action: 'click me'
});
snack.addEventListener('click', function(e) {
console.log(e.action);
});
win.add([btn, snack]);
win.open();
Properties 27
Inherited from Titanium.UI.View
Boolean value to remove the long press notification for the device's accessibility service.
Default: true
Text of the right hand action button
Inherited from Titanium.Proxy
The name of the API that this proxy corresponds to.
Inherited from Titanium.Proxy
Indicates if the proxy will bubble an event to its parent.
Default: true
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
id
StringInherited from Titanium.UI.View
View's identifier.
Inherited from Titanium.UI.View
A value indicating the render mode of the View
Default: false
Display time of the Snackbar
Use with on of the constants: Ti.UI.Android.Snackbar.LENGTH_SHORT,
Ti.UI.Android.Snackbar.LENGTH_LONG or
Ti.UI.Android.Snackbar.LENGTH_INDEFINITE
Default: LENGTH_SHORT
Use with length to specify the display time.
Use with length to specify the display time.
Use with length to specify the display time.
Inherited from Titanium.Proxy
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
Text of Snackbar
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.
Inherited from Titanium.UI.View
The default text to display in the control's tooltip.
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
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.
Methods 10
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
|
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.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.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
|
Show the Snackbar
stopAnimation
since 12.1.0Inherited from Titanium.UI.View
Stops a running animation.
Events 2
Fired when the action button is clicked
| Event properties | Type | Description |
|---|---|---|
| action | String | The text of the action button. |
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. |
