Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-754] Bug in ImageView.size.width

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionCannot Reproduce
Resolution Date2012-01-19T06:30:50.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
Reporterkarl
AssigneeNeeraj Gupta
Created2011-04-15T02:35:44.000+0000
Updated2012-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.

Comments

  1. Stephen Tramer 2011-04-15

    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.

  2. Paul Dowsett 2012-01-19

    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);
       

JSON Source