# Titanium.UI.Android.CollapseToolbar

> A collapsing toolbar layout.

- Source: https://titaniumsdk.com/docs/sdk/12.7.0/Titanium.UI.Android.CollapseToolbar
- Titanium SDK version: 12.7.0
- Kind: view
- Platforms: Android
- Since: Titanium SDK 12.1.0
- Extends: Titanium.UI.View
- Inheritance: Titanium.UI.View > Titanium.Proxy

| Android |
| ------- |
| ![Android](./collpasetoolbar_android.jpg) |

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.

## Example: Simple setup

The following code shows a simple drawer-layout usage.

``` js
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();
```

## Example: Alloy example

``` js
<Alloy>
	<Window>

		<CollapseToolbar platform="android">

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

	</Window>
</Alloy>
```

## Properties

### barColor

- Type: String
- Platforms: Android

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

### color

- Type: String
- Platforms: Android

Color of the title.

### contentScrimColor

- Type: String
- Platforms: Android

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

### contentView

- Type: Titanium.UI.View
- Platforms: Android

Main view below the toolbar.

### displayHomeAsUp

- Type: Boolean
- Platforms: Android
- Permission: write-only

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

See also: [setDisplayHomeAsUpEnabled](https://developer.android.com/reference/android/app/ActionBar.html#setDisplayHomeAsUpEnabled(boolean))
in the Android Developer Reference.

### flags

- Type: Number
- Platforms: Android

Scroll flags. Check [Android documentation](https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams#constants_1) for more details.

Accepts: `Titanium.UI.Android.SCROLL_FLAG_ENTER_ALWAYS`, `Titanium.UI.Android.SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED`, `Titanium.UI.Android.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED`, `Titanium.UI.Android.SCROLL_FLAG_NO_SCROLL`, `Titanium.UI.Android.SCROLL_FLAG_SCROLL`, `Titanium.UI.Android.SCROLL_FLAG_SNAP`, `Titanium.UI.Android.SCROLL_FLAG_SNAP_MARGINS`

### image

- Type: String
- Platforms: Android

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

### imageHeight

- Type: Number
- Platforms: Android
- Default: `250`

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

### navigationIconColor

- Type: String
- Platforms: Android

Color of the back arrow.

### onHomeIconItemSelected

- Type: Callback
- Platforms: Android
- Permission: write-only

Callback function called when the home icon is clicked.

### title

- Type: String
- Platforms: Android

Title of the toolbar.

## Inherited members

8 members are inherited. Each is documented on the type that declares it.

- [Titanium.Proxy](https://titaniumsdk.com/docs/sdk/12.7.0/Titanium.Proxy.md): `apiName`
- [Titanium.UI.View](https://titaniumsdk.com/docs/sdk/12.7.0/Titanium.UI.View.md): `accessibilityDisableLongPress`, `height`, `id`, `rotate`, `stopAnimation`, `tooltip`, `top`

---

- This corpus documents Titanium SDK 13.4.1. Anything here that does not name a version describes 13.4.1.
- Titanium is maintained by TiDev. The Appcelerator toolchain is retired: there is no `appc` CLI, no Appcelerator Studio and no hosted build service. The supported CLI is `titanium` on npm, invoked as `ti`.

