{ "id": "87082", "key": "TIMOB-7836", "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": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" }, { "id": "13170", "name": "Sprint 2012-06", "archived": true, "released": true, "releaseDate": "2012-03-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-05-02T12:50:23.000+0000", "created": "2012-02-28T08:12:01.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "module_view", "parity", "qe-testadded" ], "versions": [ { "id": "12677", "description": "Release 1.8 Service Pack 1", "name": "Release 1.8.1", "archived": true, "released": true, "releaseDate": "2012-01-31" }, { "id": "13070", "description": "Release 1.8 Service Pack 2", "name": "Release 1.8.2", "archived": true, "released": true, "releaseDate": "2012-02-29" } ], "issuelinks": [ { "id": "15428", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "87012", "key": "TIMOB-7819", "fields": { "summary": "Android: View - height:'auto' causing view to expand rather than contract to the size of its children", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "15734", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "87083", "key": "TIMOB-7837", "fields": { "summary": "Android: View - height:'auto' causing child view to not be displayed", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-05-02T12:50:23.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": "Setting the height of a view to 'auto' causes the view to be displayed at the top of parent as if you had set 'view.top = 0;'.\r\nWhen the height of the view is set to something constant, it is displayed at the center of the parent view as it should be.\r\n\r\nh4. Steps to reproduce:\r\nStep 1: run the code below\r\nStep 2: notice the the red view is at the top of the window (it should be centered vertically)\r\nStep 3: in sectionView change \"height: 'auto'\" to \"height: 50\"\r\nStep 4: run the app again\r\nStep 5: notice that the view is centered vertically in the window\r\n\r\n{code:title=app.js}\r\nvar win = Ti.UI.createWindow({backgroundColor:'white'});\r\nwin.open();\r\n\r\nvar section = createSectionView('TEST');\r\nwin.add(section);\r\n\r\nfunction createSectionView(text){\r\n\t// using 'auto' here causes the view to be displayed at the top instead of\r\n\t// being centered in the parent\r\n\tvar sectionView = Ti.UI.createView({\r\n\t\theight: 'auto',\r\n\t\t// height: 50,\r\n\t\tlayout: 'vertical',\r\n\t});\r\n\t// using 'auto' here causes clickView to not be displayed\r\n\tvar sectionHeader = Ti.UI.createView({\r\n\t\theight: 'auto',\r\n\t\t// height: 30,\r\n\t\tbackgroundColor:'red',\r\n\t});\r\n\tvar sectionHeaderLabel = Ti.UI.createLabel({\r\n\t\ttext: text,\r\n\t\theight: 'auto',\r\n\t\ttop: 2,\r\n\t\tbottom: 3,\r\n\t\tleft: 10,\r\n\t\tright: 10,\r\n\t\tcolor: '#FFF',\r\n\t});\r\n\tvar clickView = Ti.UI.createView({\r\n\t\tbackgroundColor: 'green',\r\n\t\topacity: 0.5,\r\n\t});\r\n\t\r\n\tsectionView.add(sectionHeader);\r\n\tsectionHeader.add(sectionHeaderLabel);\r\n\tsectionHeader.add(clickView);\r\n\t\r\n\treturn sectionView;\r\n};\r\n{code}", "attachment": [], "flagged": false, "summary": "Android: View - height:'auto' causing view to be placed at the top of its parent rather than centering in the parent", "creator": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "TiSDK 1.8.1, V8\r\nTiSDK 1.8.2 (02/23/12 17:46 59b3a90), V8\r\nAndroid Emulator 2.3.3", "comment": { "comments": [ { "id": "186239", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The behavior for this has changed as a result of the new composite layout spec: https://wiki.appcelerator.org/display/guides2/UI+Composite+Layout+Behavior+Spec\r\n\r\nWith the new layout spec you can achieve something similar by the following:\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({backgroundColor:'white'});\r\nwin.open();\r\n\r\nvar section = createSectionView('TEST');\r\nwin.add(section);\r\n\r\nfunction createSectionView(text){\r\n\t// using 'auto' here causes the view to be displayed at the top instead of\r\n\t// being centered in the parent\r\n\tvar sectionView = Ti.UI.createView({\r\n\t\ttop: '50%',\r\n\t\theight: 'auto',\r\n\t\t// height: 50,\r\n\t\tlayout: 'vertical',\r\n\t});\r\n\t// using 'auto' here causes clickView to not be displayed\r\n\tvar sectionHeader = Ti.UI.createView({\r\n\t\theight: Ti.UI.SIZE,\r\n\t\t// height: 30,\r\n\t\tbackgroundColor:'red',\r\n\t});\r\n\tvar sectionHeaderLabel = Ti.UI.createLabel({\r\n\t\ttext: text,\r\n\t\theight: 'auto',\r\n\t\ttop: 2,\r\n\t\tbottom: 3,\r\n\t\tleft: 10,\r\n\t\tright: 10,\r\n\t\tcolor: '#FFF',\r\n\t});\r\n\tvar clickView = Ti.UI.createView({\r\n\t\tbackgroundColor: 'green',\r\n\t\theight: Ti.UI.SIZE,\r\n\t\topacity: 0.5,\r\n\t});\r\n\t\r\n\tsectionView.add(sectionHeader);\r\n\t// sectionHeader.add(sectionHeaderLabel);\r\n\tclickView.add(sectionHeaderLabel);\r\n\tsectionHeader.add(clickView);\r\n\t\r\n\treturn sectionView;\r\n};\r\n{code}\r\n", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-03-13T10:46:36.000+0000", "updated": "2012-03-13T10:46:36.000+0000" }, { "id": "186251", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR to achieve parity with iOS ready here: https://github.com/appcelerator/titanium_mobile/pull/1659", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-03-13T11:49:36.000+0000", "updated": "2012-03-13T11:49:36.000+0000" }, { "id": "186370", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Could that Wiki page be publicly available? I'm getting this message:\r\n\r\nPage Not Found\r\n\r\nThe page you were trying to reach could not be found. This could be because:\r\n\r\n The page does not exist.\r\n The page exists, but you do not have permission to view it.\r\n", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2012-03-14T00:06:50.000+0000", "updated": "2012-03-14T00:06:50.000+0000" }, { "id": "186409", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "That wiki link should be public once we release 2.0", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-03-14T08:36:55.000+0000", "updated": "2012-03-14T08:36:55.000+0000" }, { "id": "186413", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "OK, thanks.", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2012-03-14T08:44:39.000+0000", "updated": "2012-03-14T08:44:39.000+0000" }, { "id": "186924", "author": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing bug. Verified fix on:\r\n\r\nSDK build: 2.0.0.v20120316171745\r\nRuntime: v8, rhino\r\nTitanium Studio, build: 2.0.0.201203152033\r\nDevice: Nexus S (2.3.6)\r\n", "updateAuthor": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-03-16T17:20:34.000+0000", "updated": "2012-03-19T10:56:21.000+0000" }, { "id": "187105", "author": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Reopening to edit comment.", "updateAuthor": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-03-19T10:56:10.000+0000", "updated": "2012-03-19T10:56:10.000+0000" }, { "id": "193467", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Open to update label\r\n", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-02T12:50:03.000+0000", "updated": "2012-05-02T12:50:03.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }