-
-
Notifications
You must be signed in to change notification settings - Fork 19
ListView Example
Michael Gangolf edited this page Apr 28, 2019
·
2 revisions
alloy.js
var TiAnimation = require('ti.animation');
index.js
var win = Ti.UI.createWindow({
backgroundColor: 'white'
});
var myTemplate = {
properties: {
width: Ti.UI.FILL,
height: 200
},
childTemplates: [{
type: 'TiAnimation.AnimationView',
bindId: 'ani',
properties: {
contentMode: 0,
width: 150,
height: 150,
loop: true,
autoStart: true
}
}]
};
var listView = Ti.UI.createListView({
templates: {
'template': myTemplate
},
defaultItemTemplate: 'template'
});
var sections = [];
var section1 = Ti.UI.createListSection();
var dataset = [{
ani: {
left: 10,
file: 'sample_lottie.json',
}
},
{
ani: {
left: 30,
file: 'sample_lottie.json',
}
},
{
ani: {
left: 50,
file: 'sample_lottie.json',
}
}
];
section1.setItems(dataset);
sections.push(section1);
listView.setSections(sections);
win.add(listView);
win.open();