{ "id": "83072", "key": "AC-2754", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2011-12-22T13:46:01.000+0000", "created": "2011-11-24T02:56:09.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "updated": "2016-03-08T07:47:39.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": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "attachment": [], "flagged": false, "summary": "Android: Scroll View's layout mechanism doesn't function well", "creator": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": "* Titanium SDK version: 1.7.6 (11/22/11 14:11 194e8e6...)\r\n* Android 3.1 (Lenovo Thinkpad Tablet)\r\n* Windows XP SP3", "comment": { "comments": [ { "id": "176994", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "This can also be closed. The issue is not in layout mechanism now, the only thing that could be issue is dimension calculation. \r\n\r\nHere is test case:\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor: '#000',\r\n\tmodal: true,\r\n\tnavBarHidden: true,\r\n\tlayout: 'vertical'\r\n});\r\n\r\nvar scrollView = Ti.UI.createScrollView({\r\n\tlayout: 'vertical',\r\n\tbackgroundColor: '#f00',\r\n\tshowVerticalScrollIndicator: true,\r\n\theight: '100%',\r\n\twidth: '100%',\r\n\tcontentHeight: 'auto',\r\n\tcontentWidth: 'auto',\r\n\ttop: 0\r\n});\r\n\r\nvar button = Ti.UI.createButton({ title: 'Test' });\r\n\r\nscrollView.add(button);\r\n\r\nvar view = Ti.UI.createView({\r\n\twidth: '100%',\r\n\theight: '10%',\r\n\tbackgroundColor: '#ff0'\r\n});\r\n\r\nscrollView.add(view);\r\n\r\nwin.add(scrollView);\r\n\r\nwin.addEventListener('open', function() {\r\n\tTi.API.debug(view.size.width);\r\n\tTi.API.debug(view.size.height);\r\n});\r\n\r\nwin.open();\r\n{code}\r\n\r\nAfter running the code, you'll see that view's height is zero and therefore is not visible on the screen.\r\nIf we move view's creation code to window's \"open\" listener, then this works fine:\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor: '#000',\r\n\tmodal: true,\r\n\tnavBarHidden: true,\r\n\tlayout: 'vertical'\r\n});\r\n\r\nvar scrollView = Ti.UI.createScrollView({\r\n\tlayout: 'vertical',\r\n\tbackgroundColor: '#f00',\r\n\tshowVerticalScrollIndicator: true,\r\n\theight: '100%',\r\n\twidth: '100%',\r\n\tcontentHeight: 'auto',\r\n\tcontentWidth: 'auto',\r\n\ttop: 0\r\n});\r\n\r\nvar button = Ti.UI.createButton({ title: 'Test' });\r\n\r\nscrollView.add(button);\r\n\r\nwin.add(scrollView);\r\n\r\nwin.addEventListener('open', function() {\r\n\tvar view = Ti.UI.createView({\r\n\t\twidth: '100%',\r\n\t\theight: '10%',\r\n\t\tbackgroundColor: '#ff0'\r\n\t});\r\n\t\r\n\tscrollView.add(view);\r\n\t\r\n\tTi.API.debug(view.size.width);\r\n\tTi.API.debug(view.size.height);\r\n});\r\n\r\nwin.open();\r\n{code}\r\n\r\n\r\nIf you think this is a bug, please let me know and I'll open new ticket.\r\n\r\n\r\n\r\nAlso, I'm not sure how scroll view's \"contentWidth\" and \"contentHeight\" functions. If I set them to percentages, they produce strange results:\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor: '#000',\r\n\tmodal: true,\r\n\tnavBarHidden: true,\r\n\tlayout: 'vertical'\r\n});\r\n\r\nvar scrollView = Ti.UI.createScrollView({\r\n\tlayout: 'vertical',\r\n\tbackgroundColor: '#f00',\r\n\tshowVerticalScrollIndicator: true,\r\n\theight: '100%',\r\n\twidth: '100%',\r\n\tcontentHeight: '100%',\r\n\tcontentWidth: '100%',\r\n\ttop: 0\r\n});\r\n\r\nvar button = Ti.UI.createButton({ title: 'Test' });\r\n\r\nscrollView.add(button);\r\n\r\nwin.add(scrollView);\r\n\r\nwin.addEventListener('open', function() {\r\n\tvar view = Ti.UI.createView({\r\n\t\twidth: '100%',\r\n\t\theight: '10%',\r\n\t\tbackgroundColor: '#ff0'\r\n\t});\r\n\t\r\n\tscrollView.add(view);\r\n\t\r\n\tTi.API.debug(view.size.width);\r\n\tTi.API.debug(view.size.height);\r\n});\r\n\r\nwin.open();\r\n{code}\r\n\r\nIf you run this example, you should see that scroll view's content width and height is about 10% of scroll view's width and height. Shouldn't they be the same?", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2011-12-22T02:08:32.000+0000", "updated": "2011-12-22T02:08:32.000+0000" }, { "id": "177061", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Ivan - your code is wrong, but this isn't your fault at all, as we need to explain the behavior in the apidocs. I have opened ticket TIMOB-6850 to address it.\r\n\r\nI will mark this ticket resolved now. Reopen if you disagree.\r\n\r\nCheers", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-12-22T13:45:47.000+0000", "updated": "2011-12-22T13:45:47.000+0000" }, { "id": "177100", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Thanks Paul, I won't reopen it, I commented this issue on new ticket.\r\n\r\n\r\nCheers.", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2011-12-23T03:06:19.000+0000", "updated": "2011-12-23T03:06:19.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }