Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Demonstrate CollapsableView Tag in Alloy.
function collapse(){
$.myView.collapse();
// $.myView.expand();
}
<Alloy>
<CollapsableView module="ui" id="myView" height="200" width="Ti.UI.FILL" layout="vertical">
<Label top="20">Hello there</Label>
<Button top="20" onClick="collapse">Collapse Me</Button>
</CollapsableView>
</Alloy>
// put in the lib folder
exports.createCollapsableView = function(args) {
var view = Ti.UI.createView(args);
view.collapse = function() {
view.expandedHeight = view.expandedHeight || view.height;
view.height = 0;
};
view.expand = function() {
view.height = view.expandedHeight;
};
return view;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment