# Titanium.UI.Android.CollapseToolbar

A collapsing toolbar layout.

Availability
12.1.0

# Overview

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

# accessibilityDisableLongPress CREATION ONLY

Availability
12.4.0
accessibilityDisableLongPress :Boolean

Boolean value to remove the long press notification for the device's accessibility service.

Will disable the "double tap and hold for long press" message when selecting an item.

Default: true


# apiName READONLY

Availability
12.1.0
apiName :String

The name of the API that this proxy corresponds to.

The value of this property is the fully qualified name of the API. For example, Titanium.UI.Button returns Ti.UI.Button.


# barColor

Availability
12.1.0
barColor :String

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


# color

Availability
12.1.0
color :String

Color of the title.


# contentScrimColor

Availability
12.1.0
contentScrimColor :String

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


# contentView

Availability
12.1.0
contentView :Titanium.UI.View

Main view below the toolbar.


# displayHomeAsUp

Availability
12.1.0
displayHomeAsUp :Boolean

Displays an "up" affordance on the "home" area of the action bar.

See also: setDisplayHomeAsUpEnabled in the Android Developer Reference.


# height

Availability
12.1.0
height :Number | String

View height, in platform-specific units.

Defaults to: If undefined, defaults to either FILL or SIZE depending on the view. See "View Types and Default Layout Behavior" in Transitioning to the New UI Layout System.

Can be either a float value or a dimension string (for example, '50%' or '40dp'). Can also be one of the following special values:

  • SIZE. The view should size itself to fit its contents.
  • FILL. The view should size itself to fill its parent.
  • 'auto'. Represents the default sizing behavior for a given type of view. The use of 'auto' is deprecated, and should be replaced with the SIZE or FILL constants if it is necessary to set the view's behavior explicitly.

This is an input property for specifying the view's height dimension. To determine the view's size once rendered, use the rect or size properties.

This API can be assigned the following constants:

# id

Availability
12.1.0
id :String

View's identifier.

The id property of the Ti.UI.View represents the view's identifier. The identifier string does not have to be unique. You can use this property with getViewById method.


# image

Availability
12.1.0
image :String

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


# imageHeight

Availability
12.1.0
imageHeight :Number

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

Default: 250


navigationIconColor :String

Color of the back arrow.


# onHomeIconItemSelected

Availability
12.1.0
onHomeIconItemSelected :Callback

Callback function called when the home icon is clicked.


# title

Availability
12.1.0
title :String

Title of the toolbar.


# tooltip

Availability
12.1.0
tooltip :String

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

Assigning a value to this property causes the tool tip to be displayed for the view. Setting the property to null cancels the display of the tool tip for the view. Note: This property is only used for apps targeting macOS Catalyst.


# top

Availability
12.1.0
top :Number | String

The view's top position.

This position is relative to the view's parent. Exact interpretation depends on the parent view's layout property. Can be either a float value or a dimension string (for example, '50%' or '10px').

This is an input property for specifying where the view should be positioned, and does not represent the view's calculated position.

# Methods

# stopAnimation

Availability
12.1.0
stopAnimation() void

Stops a running animation.

Stops a running view Titanium.UI.Animation.

Returns

Type
void