{ "id": "63834", "key": "TIMOB-3202", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11244", "name": "Release 1.7.0", "archived": true, "released": true, "releaseDate": "2011-06-13" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-05-17T14:06:44.000+0000", "created": "2011-04-15T03:39:19.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "android", "auto", "defect", "height", "klist", "label", "reported-1.6.0", "rplist", "width" ], "versions": [], "issuelinks": [], "assignee": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-05-17T14:06:44.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}

If a label width or height is set to 'auto' on android you can\nnot reference label.width or label.size.with. Both work on iOS.

{html}", "attachment": [], "flagged": false, "summary": "Android Bug: height or width set to 'auto' not available to reference", "creator": { "name": "aleard", "key": "aleard", "displayName": "Alan Leard", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "aleard", "key": "aleard", "displayName": "Alan Leard", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "130273", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Fixed title, fixed tags, Please provide code that demonstrates\nthe example. If this came from Helpdesk, you need to include that\nlink and add the rplist tag.

\n

Also this behavior is going to be addressed in 1.7.0 as the API\nis inconsistent on both platforms.

{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:39:20.000+0000", "updated": "2011-04-15T03:39:20.000+0000" }, { "id": "130274", "author": { "name": "aleard", "key": "aleard", "displayName": "Alan Leard", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Here is some testing code:

\n
\nvar win = Ti.UI.createWindow();\n\nvar label = Titanium.UI.createLabel({\n    text:'Text',\n    color:'#000000',\n    font:{ fontFamily:'Helvetica Neue', fontSize:18, fontWeight:'bold'},\n    textAlign:'left',\n    left:15,\n    top:2,\n    height:26,\n    width:'auto'\n});\n\nwin.add(label);\n\nalert('label.width: '+label.width);\n\nalert('label.height: '+label.height);\n\nalert('label.size.width: '+label.size.width);\n\nalert('label.size.height: '+label.size.height);\n\nwin.open();\n
\n

Reference HD Ticket: http://developer.appcelerator.com/helpdesk/view/74851

{html}", "updateAuthor": { "name": "aleard", "key": "aleard", "displayName": "Alan Leard", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:39:20.000+0000", "updated": "2011-04-15T03:39:20.000+0000" }, { "id": "130275", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "{html}

Simpler Sample Code

\n
\nvar label = Ti.UI.createLabel();\nlabel.height = 'auto';\nalert(label.height);\n
\n

Tested On

\n

Titanium SDK version: 1.6.0 (02/23/11 12:34 9882e81)
\nWORKS on iPhone Simulator 4.2
\nBROKEN on Android Device EPIC 4G 2.1

\n

2nd Helpdesk Ticket

\n

http://developer.appcelerator.com/helpdesk/view/75481

{html}", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-04-15T03:39:21.000+0000", "updated": "2011-04-15T03:39:21.000+0000" }, { "id": "130276", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

In 1.7.0 that should return the layout setting on both iOS and\nAndroid. Having configuration properties doubling as dynamic values\ncauses all sorts of problems like this. The correct response from\nthis is 'auto'

{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:39:21.000+0000", "updated": "2011-04-15T03:39:21.000+0000" }, { "id": "130277", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "{html}

Workaround

\n

While we fix this, the following workaround will allow you to\nachieve the same results with only a little bit more work.

\n
\nvar label = Ti.UI.createLabel();\nlabel.rawHeight = label.height = 'auto';\nalert(label.rawHeight);\n
{html}", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-04-15T03:39:22.000+0000", "updated": "2011-04-15T03:39:22.000+0000" }, { "id": "132680", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "For the above usecase to work, the label's `size` property must be queried after the window has been opened, using the window `open` eventListener:\n\n{code}\nwin.addEventListener(\"open\", function(){\n\tTi.API.info(\"label.size.width = \" + label.size.width);\n\tTi.API.info(\"label.size.height = \" + label.size.height);\n});\n{code}\n\nDoesn't iOS require this?", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-04-25T05:59:46.000+0000", "updated": "2011-04-25T05:59:46.000+0000" }, { "id": "133815", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "On iOS, the test app reports: \"2\"\nOn Android, the test app reports: \"auto\"\n\nI slightly modified the code:\n\nvar label = Ti.UI.createLabel();\nlabel.height = 'auto';\n alert('Label height is: '+label.height);", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-05-17T11:48:36.000+0000", "updated": "2011-05-17T11:48:36.000+0000" }, { "id": "133825", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as this is correctly reporting \"auto\". Created new iOS bug to attempt parity. The bug is TIMOB-4123.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-05-17T14:06:44.000+0000", "updated": "2011-05-17T14:06:44.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }