Skip to content

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Apr 14, 2025

based on #14093 by @Max87ZA but with some changes:

Screenshot_20250414-190619

Screenshot_20250414-190624

Example:

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, title: "Collapsing toolbar", contentView: centerView});


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

// NEW: -------------------------------------- add menu items --------------------------------------
	collapsingToolbar.addEventListener("click", function(e) {
		alert(e.itemId + " clicked");
	});
	collapsingToolbar.addMenuItem({
		title: "Menu item",
    showAsAction: Ti.Android.SHOW_AS_ACTION_NEVER // or Ti.Android.SHOW_AS_ACTION_ALWAYS
	});
});

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant