{ "id": "165904", "key": "TIMOB-24388", "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": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2017-02-10T13:55:34.000+0000", "created": "2017-02-09T02:24:34.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [ "ipass1" ], "versions": [], "issuelinks": [], "assignee": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-28T20:19:18.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": "h5.Reproduce\r\n1. Run the following code on Both iOS and Android devices\r\n{code}\r\nvar OS_IOS = (Ti.Platform.name === 'iPhone OS');\r\n\r\nvar locationBlockWindow = Ti.UI.createWindow({\r\n\tbackgroundColor:\"#E6ffffff\"\r\n});\r\n\r\nvar transView = Ti.UI.createView({\r\n\ttop:Ti.Platform.displayCaps.platformHeight/(OS_IOS ? 3 : 6),\r\n\tbottom:Ti.Platform.displayCaps.platformHeight/(OS_IOS ? 3 : 6),\r\n\tleft:40,\r\n\tright:40,\r\n\tlayout:\"vertical\",\r\n\twidth:Ti.UI.FILL,\r\n\theight:Ti.UI.FILL,\r\n\tbackgroundColor:\"#80E7832B\",\r\n\tborderRadius: 5\r\n});\r\n\r\nvar labelTxt = Ti.UI.createLabel({\r\n\tfont: { fontSize:'18dp' },\r\n\ttext: 'IAS Dispatch app is disabled while driving for your safety. Please use the app when vehicle is not in motion.',\r\n\ttextAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,\r\n\tcenter: {\r\n\t\tx:0,\r\n\t\t//y:100\r\n\t\ty:Ti.Platform.displayCaps.platformHeight/(OS_IOS ? 6 : 24),\r\n\t},\r\n\twidth: Ti.UI.SIZE,\r\n\theight: Ti.UI.SIZE,\r\n\tleft: 10,\r\n\tright: 10,\r\n});\r\n \r\ntransView.add(labelTxt);\r\nlocationBlockWindow.add(transView);\r\nlocationBlockWindow.open();\r\n\r\nTi.API.info('Top: ' + transView.getTop());\r\nTi.API.info('Center: ' + labelTxt.getCenter().y);\r\n{code}\r\n\r\nh5.Problem\r\nIn labelTxt the:\r\n{code}\r\ncenter: {\r\n\t\tx:0,\r\n\t\ty:Ti.Platform.displayCaps.platformHeight/(OS_IOS ? 6 : 24),\r\n},\r\n{code}\r\nworks in iOS but in Android. The \"Ti.API.info('Center: ' + labelTxt.getCenter().y);\" returns a valid number but we see no impact on the positioning of the label on Android.", "attachment": [ { "id": "61546", "filename": "test.png", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-02-10T13:54:52.000+0000", "size": 29505, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: 'center' property for Label does not work well on Android", "creator": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "subtasks": [], "reporter": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "environment": "SDK 6.0.1.GA, 6.0.0.GA", "closedSprints": [ { "id": 808, "state": "closed", "name": "2017 Sprint 03 SDK", "startDate": "2017-01-28T21:12:30.215Z", "endDate": "2017-02-12T21:12:00.000Z", "completeDate": "2017-02-12T23:37:14.667Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "406802", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~sliang] Firstly, in the example given both {{top}} and {{bottom}} are set to the same value, making the view invisible. Secondly, {{center}} will not work on components added to a view with a {{layout}} type defined.\r\n\r\n{code:js}\r\nvar win = Ti.UI.createWindow(),\r\n view = Ti.UI.createView({\r\n //top: Ti.Platform.displayCaps.platformHeight/6,\r\n //bottom: Ti.Platform.displayCaps.platformHeight/6,\r\n left: 40,\r\n right: 40,\r\n //layout: 'vertical',\r\n width: Ti.UI.FILL,\r\n height: Ti.UI.FILL,\r\n backgroundColor: 'red',\r\n borderRadius: 5\r\n }),\r\n lbl = Ti.UI.createLabel({\r\n font: {\r\n fontSize: '18dp'\r\n },\r\n text: 'IAS Dispatch app is disabled while driving for your safety. Please use the app when vehicle is not in motion.',\r\n textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,\r\n center: {\r\n x: 0,\r\n y: Ti.Platform.displayCaps.platformHeight/24\r\n },\r\n width: Ti.UI.SIZE,\r\n height: Ti.UI.SIZE,\r\n left: 10,\r\n right: 10\r\n });\r\n\r\nview.add(lbl);\r\nwin.add(view);\r\n{code}\r\n\r\n!test.png|thumbnail!", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-02-10T13:53:55.000+0000", "updated": "2017-02-10T13:55:09.000+0000" }, { "id": "407536", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "body": "[~gmathews]\r\nPlease confirm the last comment.", "updateAuthor": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2017-02-22T01:41:55.000+0000", "updated": "2017-02-22T01:41:55.000+0000" }, { "id": "407571", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~sliang] Correct, I'm not sure why you would define the exact position of a View if you're using a layout to determine the positioning?", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-02-22T12:20:09.000+0000", "updated": "2017-02-22T12:20:09.000+0000" }, { "id": "416029", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as invalid. Please reopen if you disagree [~sliang]", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-03-28T20:19:11.000+0000", "updated": "2017-03-28T20:19:11.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }