[TIMOB-3202] Android Bug: height or width set to 'auto' not available to reference
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-05-17T14:06:44.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.7.0 |
Components | Android |
Labels | android, auto, defect, height, klist, label, reported-1.6.0, rplist, width |
Reporter | Alan Leard |
Assignee | Don Thorp |
Created | 2011-04-15T03:39:19.000+0000 |
Updated | 2011-05-17T14:06:44.000+0000 |
Description
If a label width or height is set to 'auto' on android you can not reference label.width or label.size.with. Both work on iOS.
Fixed title, fixed tags, Please provide code that demonstrates the example. If this came from Helpdesk, you need to include that link and add the rplist tag.
Also this behavior is going to be addressed in 1.7.0 as the API is inconsistent on both platforms.
Here is some testing code:
Reference HD Ticket: http://developer.appcelerator.com/helpdesk/view/74851">http://developer.appcelerator.com/helpdesk/view/74851
Simpler Sample Code
Tested On
Titanium SDK version: 1.6.0 (02/23/11 12:34 9882e81)
WORKS on iPhone Simulator 4.2
BROKEN on Android Device EPIC 4G 2.1
2nd Helpdesk Ticket
http://developer.appcelerator.com/helpdesk/view/75481">http://developer.appcelerator.com/helpdesk/view/75481
In 1.7.0 that should return the layout setting on both iOS and Android. Having configuration properties doubling as dynamic values causes all sorts of problems like this. The correct response from this is 'auto'
Workaround
While we fix this, the following workaround will allow you to achieve the same results with only a little bit more work.
For the above usecase to work, the label's
size
property must be queried after the window has been opened, using the windowopen
eventListener:Doesn't iOS require this?
On iOS, the test app reports: "2" On Android, the test app reports: "auto" I slightly modified the code: var label = Ti.UI.createLabel(); label.height = 'auto'; alert('Label height is: '+label.height);
Closing as this is correctly reporting "auto". Created new iOS bug to attempt parity. The bug is TIMOB-4123.