[TIMOB-754] Bug in ImageView.size.width
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Trivial |
| Status | Closed |
| Resolution | Cannot Reproduce |
| Resolution Date | 2012-01-19T06:30:50.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Android |
| Labels | n/a |
| Reporter | karl |
| Assignee | Neeraj Gupta |
| Created | 2011-04-15T02:35:44.000+0000 |
| Updated | 2012-02-09T10:56:04.000+0000 |
Description
I got the following code:
var imageView = Ti.UI.createImageView({
image : imageFile,
left : 7,
top : 6,
height : (window_height / 3) - 10,
}); headerView.add(imageView);
Ti.API.info("imageView.size.width: " + imageView.size.width);
The debug statement returns always 7. Actually the debug returns every value I change "left" in the create-Statement to. The Image gets displayed correctly but this is a bug.
Fixed under iOS, but original tags do not indicate which platform was targeted. Assigning to Don/TBS for triage.
Note that it may not have ever even been valid under android... but we have to check.
Cannot reproduce (Titanium 1.9.0 (2012/01/16 11:16 366b32d, Android 2.2, emulator), so assume this has been resolved in the meantime. Using the following code, the value returns correctly. Refer to TIMOB-5303 and TIMOB-7266 for information about why setTimeout is necessary.
Ti.UI.backgroundColor = 'white'; var win = Ti.UI.createWindow({ exitOnClose: true }); var imageView = Ti.UI.createImageView({ image:'/images/myimage1.jpg', left: 7, top: 6, height: (Ti.Platform.displayCaps.platformHeight / 3) - 10 }); win.add(imageView); win.open(); setTimeout(function(){ Ti.API.info("imageView.size.width: " + imageView.size.width); }, 3000);