[TIMOB-13318] Android - Allow ListView templates outside of ListView
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | Low |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Android |
| Labels | n/a |
| Reporter | Pedro Enrique |
| Assignee | Unknown |
| Created | 2013-04-02T19:20:27.000+0000 |
| Updated | 2018-02-28T20:03:40.000+0000 |
Description
It would be ideal to use the template concept for all titanium components, such as windows. For example:
var win = Ti.UI.createWindow({
backgroundColor: 'white'
});
var template = {
type: 'Ti.UI.ScrollView',
bindId: 'scrollView',
properties: {
width: Ti.UI.FILL,
height: Ti.UI.SIZE,
layout: 'vertical'
},
childTemplates: [
{
type: 'Ti.UI.Button',
bindId: 'last_button',
properties: {
title: 'Button 11',
height: Ti.UI.SIZE,
left: 20,
right: 20,
top: 10
},
events: {
'click': onClick
}
}
]
};
win.addFromTemplate(template);
var scrollView = win.getViewFromBindId('scrollView');
function onClick(e) {
scrollView.backgroundColor = 'red';
}
win.open();
Same for iOS