{ "id": "62600", "key": "TIMOB-1968", "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": "11225", "name": "Release 1.5.0", "archived": true, "released": true, "releaseDate": "2010-12-14" } ], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2011-04-15T03:06:52.000+0000", "created": "2011-04-15T03:06:51.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "android", "defect", "ignore", "left", "right", "view", "width" ], "versions": [], "issuelinks": [], "assignee": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-02T18:18:02.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}

Under the iOS implementation if you create a view with a width\nof 30 and then set left & right you get a view of 30 centered\nwithin the window. In Android, this is presently creating a view\nthat stretches to fill the entire left/right space completely\nignoring the width.

\n

var win = Titanium.UI.currentWindow;
\nwin.add(Titanium.UI.createView({

\n
\n        backgroundColor: 'red',\n        top: 10,\n        left: 5,\n        right: 5,\n        width: 75,\n        height: 75\n    }));\n
{html}", "attachment": [], "flagged": false, "summary": "Android - View ignores width w/ left & right set.", "creator": { "name": "mikerobinson", "key": "mikerobinson", "displayName": "Mike Robinson", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mikerobinson", "key": "mikerobinson", "displayName": "Mike Robinson", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "127116", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

If you want it centered, you should leave off left and right.\nThe condition is technically undefined. We will be formalizing what\nshould happen in undefined conditions, but averaging out the space\nis not what one would normally expect.

{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:06:52.000+0000", "updated": "2011-04-15T03:06:52.000+0000" }, { "id": "127117", "author": { "name": "mikerobinson", "key": "mikerobinson", "displayName": "Mike Robinson", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I agree that this condition isn't exactly defined, however since\nit is performing that way on iOS I kind of expected it to transfer\nover (you see it in one implementation, you would normally expect\nit in the other).

\n

The challenge for me lies in the fact, I am trying to place\nmultiple objects in a horizontal line, keeping them centered in\nboth orientations of the window. See my example below in iOS to see\nwhat I am trying. While in this example I could create a view, add\none item left, one item right, and another undefined....the\nchallenge comes that I am trying to add 7 items horizontally. What\ndo you recommend then?

\n

var win = Titanium.UI.currentWindow;
\nwin.add(Titanium.UI.createView({

\n
\n    backgroundColor: 'red',\n    top: 10,\n    left: 5,\n    right: 5,\n    width: 25,\n    height: 25\n}));\n
\n

win.add(Titanium.UI.createView({

\n
\n    backgroundColor: 'white',\n    top: 10,\n    left: 5,\n    right: 100,\n    width: 25,\n    height: 25\n}));\n
\n

win.add(Titanium.UI.createView({

\n
\n    backgroundColor: 'blue',\n    top: 10,\n    left: 100,\n    right: 5,\n    width: 25,\n    height: 25\n}));\n
{html}", "updateAuthor": { "name": "mikerobinson", "key": "mikerobinson", "displayName": "Mike Robinson", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:06:52.000+0000", "updated": "2011-04-15T03:06:52.000+0000" }, { "id": "127118", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

In the future, please go through helpdesk or Q&A LH is for\nverified problem only and not general support.

\n

Simply create a View with only width and height defined, then\nadd your other views to it defining height, width, and left. The\ncontainer view will center and the other views will be relative to\nthe container views origin.

\n
\n\nvar win = Ti.UI.currentWindow;\n\nvar container = Ti.UI.createView({ height : 25, width : 75});\nwin.add(container);\n\nvar v1 = Ti.UI.createView({left : 5, width : 25, height : 25});\nvar v2 = Ti.UI.createView({left : 35, width : 25, height : 25});\nvar v3 = Ti.UI.createView({left : 65, width : 25, height : 25});\n\nwin.add(v1);\nwin.add(v2);\nwin.add(v3);\n
{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:06:52.000+0000", "updated": "2011-04-15T03:06:52.000+0000" }, { "id": "408333", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing as invalid.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-02T18:17:57.000+0000", "updated": "2017-03-02T18:17:57.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }