{ "id": "63870", "key": "TIMOB-3238", "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": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-01-10T11:49:07.000+0000", "created": "2011-04-15T03:40:09.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "module_views", "qe-testadded" ], "versions": [ { "id": "11233", "name": "Release 1.6.0", "archived": true, "released": true, "releaseDate": "2011-02-23" } ], "issuelinks": [ { "id": "14724", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "85327", "key": "TIMOB-7344", "fields": { "summary": "iOS: Views - Nested view cannot be displayed when dimension property is defined using percentage", "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": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-11-07T05:46:28.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": "I'm using latest Titanium mobile (1.6.1) and Android emulator (Galaxy Tab addon 2.2). I have problem with dimensions defined as\r\npercentage when I put view in another view. Here is test case:\r\n\r\n{code:lang=javascript|title=app.js}\r\n var win = Ti.UI.createWindow({\r\n layout: 'vertical', \r\n fullscreen: true, \r\n height : Ti.Platform.displayCaps.platformHeight,\r\n width : Ti.Platform.displayCaps.platformWidth\r\n});\r\n\r\nvar view = Ti.UI.createView({\r\n layout: 'horizontal',\r\n height: 50,\r\n backgroundColor: '#ccf',\r\n width: '50%'\r\n});\r\nvar nested_view = Ti.UI.createView({\r\n height: 50,\r\n backgroundColor: '#cfc',\r\n width: '50%'\r\n});\r\n\r\nview.add(nested_view);\r\nwin.add(view);\r\nwin.open();\r\n{code}\r\n\r\nSecond view, \"nested_view\", doesn't show at all, but I think it should and it should have half of \"view\" width.\r\n", "attachment": [ { "id": "24797", "filename": "screenshot_458.png", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-12-21T02:53:04.000+0000", "size": 8641, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: UI - A problem with dimensions defined as percentage in nested views", "creator": { "name": "ivanskugor", "key": "ivanskugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "ivanskugor", "key": "ivanskugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "130351", "author": { "name": "ivanskugor", "key": "ivanskugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Same problem applies to TableView. I haven't checked for other\n\"views\".

{html}", "updateAuthor": { "name": "ivanskugor", "key": "ivanskugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:40:09.000+0000", "updated": "2011-04-15T03:40:09.000+0000" }, { "id": "130352", "author": { "name": "tonylukasavage1", "key": "tonylukasavage1", "displayName": "tonylukasavage1", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

I'm also having the same problem as Ivan. With the following\ncode I am unable to see the viewInputs view. This is the case even\nis viewInputs contains other components as well.

\n

var win = Titanium.UI.createWindow();
\nwin.backgroundColor = '#dddddd';
\nwin.layout = 'vertical';

\n

var viewTop = Titanium.UI.createView({
\nborderRadius:10, backgroundColor:'#ffffff', borderColor:'#000000',\nborderWidth:2, width:'95%', height:'20%', top:'2.5%',\nlayout:'horizontal' }); win.add(viewTop);

\n

var viewInputs = Titanium.UI.createView({

\n
\nwidth:'50%',\nheight:'100px',\nbackgroundColor:'#ff0000',\ntop:5,\nleft:5,\nlayout:'vertical'\n
\n

}); viewTop.add(viewInputs);

\n

win.open();

{html}", "updateAuthor": { "name": "tonylukasavage1", "key": "tonylukasavage1", "displayName": "tonylukasavage1", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:40:09.000+0000", "updated": "2011-04-15T03:40:09.000+0000" }, { "id": "130353", "author": { "name": "joeientry", "key": "joeientry", "displayName": "Joe iEntry", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I am having same issue with Ti Mobile 1.6.1 and Android 1.6\nattempting percentage width on a view (just plain view).

{html}", "updateAuthor": { "name": "joeientry", "key": "joeientry", "displayName": "Joe iEntry", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:40:10.000+0000", "updated": "2011-04-15T03:40:10.000+0000" }, { "id": "130354", "author": { "name": "joeientry", "key": "joeientry", "displayName": "Joe iEntry", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Workaround

\n

To calculate percentage dimensions one can:

\n
\nvar width = Math.round(Ti.Platform.displayCaps.platformWidth*0.9); // 90%\nvar height = Math.round(Ti.Platform.displayCaps.platformHeight*0.9); // 90%\n
\n

Source: Appcelerator\nQ&A

{html}", "updateAuthor": { "name": "joeientry", "key": "joeientry", "displayName": "Joe iEntry", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:40:10.000+0000", "updated": "2011-04-15T03:40:10.000+0000" }, { "id": "130355", "author": { "name": "ivanskugor", "key": "ivanskugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

That works for elements which parent element has\n\"Ti.Platform.displayCaps.platformWidth\" width.

\n

In general, parent's width/height can be whatever, percentages\nare there so you don't need to calculate it manually, they are\ncalculated automatically depending on parent element size.

{html}", "updateAuthor": { "name": "ivanskugor", "key": "ivanskugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:40:10.000+0000", "updated": "2011-04-15T03:40:10.000+0000" }, { "id": "130356", "author": { "name": "tonylukasavage1", "key": "tonylukasavage1", "displayName": "tonylukasavage1", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

Dimensions calculated like Joe iEntry suggests don't get\nrecalculated on orientation change. Dimensions specified with a\npercentage value do. This is a major problem for me in my current\nproject. I can't get horizontal layouts to work with percentage\ndimensions (iPad if that matters). Instead I'm using hacks and\ncustom code to do something pretty basic.

\n

What's going on here?

{html}", "updateAuthor": { "name": "tonylukasavage1", "key": "tonylukasavage1", "displayName": "tonylukasavage1", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:40:10.000+0000", "updated": "2011-04-15T03:40:10.000+0000" }, { "id": "130357", "author": { "name": "joeientry", "key": "joeientry", "displayName": "Joe iEntry", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I understand this is not meant for discussion, but Tony, I\nhaven't tested my app with orientation change. This will be a must.\nCan you post your workaround?

{html}", "updateAuthor": { "name": "joeientry", "key": "joeientry", "displayName": "Joe iEntry", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:40:10.000+0000", "updated": "2011-04-15T03:40:10.000+0000" }, { "id": "130358", "author": { "name": "tonylukasavage1", "key": "tonylukasavage1", "displayName": "tonylukasavage1", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

I don't have code I can post right now, but the idea is to set\ndimensions like this (similar to how you stated above):

\n

child.width = parent.width * 0.5;

\n

Keep a reference to this child in an array, and then resize it\nin a Titanium.Gesture.orientationchange event handler. It sucks,\nbut it works.

{html}", "updateAuthor": { "name": "tonylukasavage1", "key": "tonylukasavage1", "displayName": "tonylukasavage1", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:40:11.000+0000", "updated": "2011-04-15T03:40:11.000+0000" }, { "id": "176692", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "This has been fixed a long time ago so it can be closed.\r\n\r\n\r\nAlso, it wrongly states it's iOS issue.", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2011-12-20T05:30:28.000+0000", "updated": "2011-12-20T05:30:28.000+0000" }, { "id": "176803", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Reporter has indicated that this issue is fixed. The included test case proves this, using 1.8.0.1 RC3 + v8. See the attached screenshot.\r\n\r\nPlease close", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-12-21T02:52:15.000+0000", "updated": "2011-12-21T02:52:15.000+0000" }, { "id": "176841", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This was noted as fixed by Paul", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-21T10:15:16.000+0000", "updated": "2011-12-21T10:15:16.000+0000" }, { "id": "178711", "author": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing issue\r\n\r\nTested with Ti Studio 1.0.8.201201091758\r\nTi Mob SDK 1.8.0.1\r\nOSX Lion\r\nNexus One 2.2.2 v8 and rhino\r\n\r\nVerified expected behavior as per the test app.js and attached screentshot", "updateAuthor": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-10T10:49:57.000+0000", "updated": "2012-01-10T10:49:57.000+0000" }, { "id": "178727", "author": { "name": "dhyde", "key": "dhyde", "displayName": "Dustin Hyde", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Added Label: qe-testadded.", "updateAuthor": { "name": "dhyde", "key": "dhyde", "displayName": "Dustin Hyde", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-10T11:48:48.000+0000", "updated": "2012-01-10T11:48:48.000+0000" }, { "id": "278603", "author": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/4887", "updateAuthor": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-11-07T05:46:28.000+0000", "updated": "2013-11-07T05:46:28.000+0000" } ], "maxResults": 14, "total": 14, "startAt": 0 } } }