Problem
When imageView in TableViewRow and Android, setImage doesn't work (just work 1st time).
Tested on
iOS 6 simulator
Razr Droid OS 2.3.5
To reproduce
run below example, click row multiple times.
Snippet code
var win = Ti.UI.createWindow({
backgroundColor : 'white'
});
var table = Ti.UI.createTableView();
var row = Ti.UI.createTableViewRow({
height : 100
});
var img = Ti.UI.createImageView({
width : 100,
height : 100
});
row.add(img);
table.data = [row];
win.add(table);
win.open();
var srcs = [
"http://t3.gstatic.com/images?q=tbn:ANd9GcQUkHHr21JB_gUXFHFVe-uXFEG2M3D25Vy6DWaifLf_1pZkwwfGkg",
"http://t0.gstatic.com/images?q=tbn:ANd9GcQ2hy-N72tStiinhPW1qUPT3kduibk-e5ufAeZtq3NI9GPRsLCl",
"http://t2.gstatic.com/images?q=tbn:ANd9GcSZLz8YqLQYatlgtRIR8qQ0Dl6tD1AoR1NYby8zJbBln1oX55UE",
"http://t3.gstatic.com/images?q=tbn:ANd9GcTSZ7Rg1kzKjqtvf06-aDgQHCvE7SKB6uh_JIdfy_e4Jj-cPuiy"
];
var index=0;
table.addEventListener('click',function(e){
var src = srcs[(index++)%4];
Ti.API.info(src);
img.setImage(src); //doesn't work! (just work 1st setImage)
//img.setBackgroundImage(src); //work!
});
Additional info
- When imageView in window, setImage work every time.
var win = Ti.UI.createWindow({
backgroundColor : 'white'
});
var img = Ti.UI.createImageView({
width : 100,
height : 100
});
win.add(img);
win.open();
var srcs = [
"http://t3.gstatic.com/images?q=tbn:ANd9GcQUkHHr21JB_gUXFHFVe-uXFEG2M3D25Vy6DWaifLf_1pZkwwfGkg",
"http://t0.gstatic.com/images?q=tbn:ANd9GcQ2hy-N72tStiinhPW1qUPT3kduibk-e5ufAeZtq3NI9GPRsLCl",
"http://t2.gstatic.com/images?q=tbn:ANd9GcSZLz8YqLQYatlgtRIR8qQ0Dl6tD1AoR1NYby8zJbBln1oX55UE",
"http://t3.gstatic.com/images?q=tbn:ANd9GcTSZ7Rg1kzKjqtvf06-aDgQHCvE7SKB6uh_JIdfy_e4Jj-cPuiy"
];
var index=0;
win.addEventListener('click',function(e){
var src = srcs[(index++)%4];
Ti.API.info(src);
img.setImage(src);
});
Hello JongEun, I did test _setImage_ worked just once. Tested _setBackgroundImage_ method which achieves the same result but multiple times. What would be the need to use setImage then?
When you use setBackgroundImage instead of setImage in TableView, Tableview have a scroll performance problem. 'setBackgroundImage' is too slower then 'setImage'.
Issue does not reproduces with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 (03/11/13 15:43 0c88429) Titanium SDK version: 3.0.2 (02/07/13 16:46 a4def81) Device: Samsung galaxy s duos Android version: 4.0.4
Closing ticket as the issue cannot be reproduced.