Skip to content
Titanium SDK
Version13.4.0

You are reading 13.4.0. See this page in 13.4.1.

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 1

Events 1

rotate

since 12.7.0

Inherited from Titanium.UI.View

Fired when the device detects a two finger rotation.

Event properties
Event propertiesTypeDescription
rotateNumber

Rotation in degrees.