Skip to content
Titanium SDK
unreleased
Versionmainunreleased

Titanium.UI.Android.CollapseToolbar

viewAndroidsince 12.1.0

Extends Titanium.UI.ViewTitanium.Proxy

A collapsing toolbar layout.

Android
Android

CollapseToolbar acts as a top-level container for window content that allows to set a parallax image and title in the toolbar. The main content goes into centerView and will automatically be scrollable.

Examples

Simple setup

The following code shows a simple drawer-layout usage.

const win = Ti.UI.createWindow({
	theme: "Theme.Titanium.DayNight.NoTitleBar"
});

const centerView = Ti.UI.createView({
	layout: "vertical",
	height: Ti.UI.SIZE
});

for (let i = 0; i < 40; ++i) {
	let lbl = Ti.UI.createLabel({
		text: "test " + i,
		height: 40
	});
	centerView.add(lbl);
}

const collapsingToolbar = Ti.UI.Android.createCollapseToolbar({
	contentScrimColor: "#333",
	top: 0,
	image: "default.png",
	title: "Collapsing toolbar"
});


win.addEventListener('open', function() {
	collapsingToolbar.contentView = centerView;
	collapsingToolbar.onHomeIconItemSelected = function() {
		alert("click click");
	};
	collapsingToolbar.displayHomeAsUp = true;
});

win.add(collapsingToolbar);
win.open();

Alloy example

<Alloy>
	<Window>

		<CollapseToolbar platform="android">

			<ContentView>
				<View backgroundColor="red" height="Ti.UI.SIZE">
					<Label>test</Label>
				</View>
			</ContentView>
		</CollapseToolbar>

	</Window>
</Alloy>

Properties 18

apiName

Stringsince Android 3.2.0, iPhone 3.2.0, iPad 3.2.0, macOS 9.2.0read-only

Inherited from Titanium.Proxy

The name of the API that this proxy corresponds to.

barColor

String

Background color of the extended toolbar when no image is shown.

color

String

Color of the title.

Background color of the small toolbar when the content is scrolled up.

image

String

Background image for the full size toolbar. Has a parallax effect when scrolling upwards.

Height of the image. Use height for the height of the extended toolbar.

Default: 250

title

String

Title of the toolbar.

tooltip

Stringsince 12.1.0iOS 15.0+

Inherited from Titanium.UI.View

The default text to display in the control's tooltip.

Methods 4

Inherited from Titanium.Proxy

Adds the specified callback as an event listener for the named event.

Parameters
ParametersTypeDescription
nameString

Name of the event.

callbackCallback<Titanium.Event>

Callback function to invoke when the event is fired.

4 fields
bubbles Boolean

True if the event will try to bubble up if possible.

cancelBubble Boolean

Set to true to stop the event from bubbling.

source Object

Source object that fired the event.

type String

Name of the event fired.

Inherited from Titanium.Proxy

Fires a synthesized event to any registered listeners.

Parameters
ParametersTypeDescription
nameString

Name of the event.

event?Dictionary

A dictionary of keys and values to add to the Titanium.Event object sent to the listeners.

Inherited from Titanium.Proxy

Removes the specified callback as an event listener for the named event.

Parameters
ParametersTypeDescription
nameString

Name of the event.

callbackCallback<Titanium.Event>

Callback function to remove. Must be the same function passed to addEventListener.

4 fields
bubbles Boolean

True if the event will try to bubble up if possible.

cancelBubble Boolean

Set to true to stop the event from bubbling.

source Object

Source object that fired the event.

type String

Name of the event fired.