/
vertical_layout_table_view.js
61 lines (47 loc) 路 2.01 KB
/
vertical_layout_table_view.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
var win = Ti.UI.currentWindow;
var tv = Ti.UI.createTableView({minRowHeight:50});
var text1 = 'I am a short sentence repeated only a few times.\nI am a short sentence repeated only a few times.';
var text2 = 'I am a medium sentence repeated slightly more than the short sentence.\nI am a medium sentence repeated slightly more than the short sentence.\nI am a medium sentence repeated slightly more than the short sentence.\nI am a medium sentence repeated slightly more than the short sentence.\n';
var text3 = 'I am a long sentence that is repeated the most in order to take up the most amount of room in a table view row.\nI am a long sentence that is repeated the most in order to take up the most amount of room in a table view row.\nI am a long sentence that is repeated the most in order to take up the most amount of room in a table view row.\nI am a long sentence that is repeated the most in order to take up the most amount of room in a table view row.\nI am a long sentence that is repeated the most in order to take up the most amount of room in a table view row.\nI am a long sentence that is repeated the most in order to take up the most amount of room in a table view row.\nI am a long sentence that is repeated the most in order to take up the most amount of room in a table view row.\n';
var data = [];
for (var i=0;i<50;i++)
{
var row = Ti.UI.createTableViewRow({height:'auto',className:"row"});
var textView = Ti.UI.createView({
height:'auto',
layout:'vertical',
left:70,
top:10,
bottom:10,
right:10
});
var l1 = Ti.UI.createLabel({
text:text1,
height:'auto'
});
textView.add(l1);
var l2 = Ti.UI.createLabel({
text:text2,
top:10,
height:'auto'
});
textView.add(l2);
var l3 = Ti.UI.createLabel({
text:text3,
top:10,
height:'auto'
});
textView.add(l3);
row.add(textView);
var imageView = Ti.UI.createImageView({
url:'../images/custom_tableview/user.png',
left:10,
top:10,
height:50,
width:50
});
row.add(imageView);
data.push(row);
}
tv.setData(data);
win.add(tv);