{ "id": "122356", "key": "TIMOB-15747", "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": "16586", "description": "Release 3.4.2", "name": "Release 3.4.2", "archived": false, "released": true, "releaseDate": "2017-03-11" }, { "id": "16704", "description": "Release 3.5.0", "name": "Release 3.5.0", "archived": false, "released": true, "releaseDate": "2015-01-13" }, { "id": "16593", "description": "Release 4.0.0", "name": "Release 4.0.0", "archived": false, "released": true, "releaseDate": "2015-05-21" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-10-29T00:50:01.000+0000", "created": "2013-11-12T18:55:01.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "SupportTeam", "module_imageview", "qe-manualtest" ], "versions": [ { "id": "15593", "description": "Release 3.1.3", "name": "Release 3.1.3", "archived": true, "released": true, "releaseDate": "2013-09-18" } ], "issuelinks": [ { "id": "33473", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "98908", "key": "TIMOB-10358", "fields": { "summary": "Android: ImageView parity for scaling behavior", "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": "42362", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "116151", "key": "TIMOB-14395", "fields": { "summary": "Android: ImageView scaling not consistent with samples in documentation", "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": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "updated": "2015-01-14T20:37:13.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": "h4. Problem Description\r\nThe 320x180 image in the testcase should be scaled UP to fill the width of the window (left: 0, right: 0) with it's height automatically adjusted to maintain the image aspect ratio. \r\n\r\nThis is exactly what happens on iOS. On android, the ImageViewHeight is contstrained to the original image height, and the image's aspect ratio is maintained, thus leaving a large unfilled area to the left and right of the image. \r\n\r\nSince the size is set to Ti.UI.SIZE, the expected behaviour would be that the image is scaled up to fit the full width of the ImageView and it's size adjusted upward to fit the contents of the scaled up image. Again, on iOS this expected behaviour is exactly what happens. But on Android, you get the unexpected result of an image with limited width.\r\n\r\nh4. Steps to reproduce\r\n1. Create a new mobile project\r\n2. Add Android to the supported platforms\r\n3. Add this testcase to app.js\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor:'white',\r\n});\r\n\r\nvar TestImage = Ti.UI.createImageView({\r\n\timage: 'http://placehold.it/320x180',\r\n\tleft: 0,\r\n\tright: 0,\r\n\t//height: Ti.UI.SIZE,\r\n\ttop: 40,\r\n\tbackgroundColor: '#ff0000'\r\n});\r\n\r\nwin.add(TestImage);\r\n\r\nwin.open();\r\n{code}\r\n4. If you run this in Android, you will see red next to the image. If you run this in iOS it will be nicely filling the space, no red in the screen. \r\n\r\n", "attachment": [ { "id": "43830", "filename": "TestApp.zip", "author": { "name": "bradleycorn", "key": "bradleycorn", "displayName": "Brad Ball", "active": true, "timeZone": "America/New_York" }, "created": "2013-11-12T18:55:01.000+0000", "size": 3103990, "mimeType": "application/zip" } ], "flagged": false, "summary": "Android: Images do not scale UP properly on Android (parity issue)", "creator": { "name": "bradleycorn", "key": "bradleycorn", "displayName": "Brad Ball", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "bradleycorn", "key": "bradleycorn", "displayName": "Brad Ball", "active": true, "timeZone": "America/New_York" }, "environment": "titanium SDK v3.1.3, \r\nAndroid Emulator 2.3.x", "closedSprints": [ { "id": 241, "state": "closed", "name": "2014 Sprint 22 SDK", "startDate": "2014-10-27T22:25:43.407Z", "endDate": "2014-11-08T01:00:00.000Z", "completeDate": "2014-11-10T20:10:00.899Z", "originBoardId": 114 }, { "id": 230, "state": "closed", "name": "2014 Sprint 21 SDK", "startDate": "2014-10-13T22:00:57.270Z", "endDate": "2014-10-25T00:00:00.000Z", "completeDate": "2014-10-27T16:33:06.432Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "280892", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Use CENTER_CROP for scaletype to scale and fit the image\r\nhttps://github.com/appcelerator/titanium_mobile/pull/5019", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2013-11-24T11:50:35.000+0000", "updated": "2013-11-24T11:50:35.000+0000" }, { "id": "282170", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Another test case:\n{code}\nvar win = Ti.UI.createWindow({\n backgroundColor:'white',\n});\n \nvar TestImage = Ti.UI.createImageView({\n image: 'http://placehold.it/320x180',\n left: 0,\n right: 0,\n height: '100%',\n top: 40,\n backgroundColor: '#ff0000'\n});\n \nwin.add(TestImage);\n \nwin.open();\n{code}", "updateAuthor": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-03T19:06:01.000+0000", "updated": "2013-12-03T19:06:01.000+0000" }, { "id": "285373", "author": { "name": "michael@webitstudios.com", "key": "michael@webitstudios.com", "displayName": "Michael DeGiovanni", "active": true, "timeZone": "Europe/Berlin" }, "body": "Why not expose in the sdk what kind of scaling type the user wants to perform on android? (http://developer.android.com/reference/android/widget/ImageView.ScaleType.html) . As it is at the moment,\r\nif even the user for example sets a width (say 96% of the platformWidth) and no height. The image is not scaled to that width. By exposing the scaling types the user can select how images are scaled in the view.", "updateAuthor": { "name": "michael@webitstudios.com", "key": "michael@webitstudios.com", "displayName": "Michael DeGiovanni", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-12-20T15:38:59.000+0000", "updated": "2013-12-20T15:38:59.000+0000" }, { "id": "286368", "author": { "name": "bradleycorn", "key": "bradleycorn", "displayName": "Brad Ball", "active": true, "timeZone": "America/New_York" }, "body": "Any progress on this issue?", "updateAuthor": { "name": "bradleycorn", "key": "bradleycorn", "displayName": "Brad Ball", "active": true, "timeZone": "America/New_York" }, "created": "2013-12-31T16:33:58.000+0000", "updated": "2013-12-31T16:33:58.000+0000" }, { "id": "286963", "author": { "name": "alexpeckham", "key": "alexpeckham", "displayName": "Alex Peckham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Any progress? Is there actually any way to have an image fill a given container now? Using Ti.UI.FILL as the ImageView width doesn't seem to work either? Android devices have loads of different screen sizes so this is essential functionality. \r\n\r\nEDIT: It seems that if one uses Ti.UI.FILL for both width and height then the image will fill a container view, however it is then up to the developer to size the container view correctly, which means to make an image fill the screen width without distorting one has to calculate the aspect ratio of the image and then multiply the screen width by this ratio to obtain the correct height for the container. I should just be able to set the width to 100%, rather than having to mess around with wrapper views and so forth just to work around missing functionality in the API ", "updateAuthor": { "name": "alexpeckham", "key": "alexpeckham", "displayName": "Alex Peckham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-07T16:10:12.000+0000", "updated": "2014-01-07T16:23:20.000+0000" }, { "id": "286965", "author": { "name": "bradleycorn", "key": "bradleycorn", "displayName": "Brad Ball", "active": true, "timeZone": "America/New_York" }, "body": "What I've been doing to work around the issue is setting my ImageView width to 100%, then using the original image's aspect ratio along with the Ti.Platform.displayCaps.platformWidth (or platformHeight, depending on orientation) to calculate the exact pixel height of the image when displayed at full width, and then set the height on the ImageView to the calculated pixel height. \r\n\r\nAgreed that all of these calculations and workarounds should not be necessary. width of FILL and height of SIZE should handle it it automatically as the docs indicate and as it works on iOS.", "updateAuthor": { "name": "bradleycorn", "key": "bradleycorn", "displayName": "Brad Ball", "active": true, "timeZone": "America/New_York" }, "created": "2014-01-07T16:28:25.000+0000", "updated": "2014-01-07T16:28:25.000+0000" }, { "id": "286970", "author": { "name": "alexpeckham", "key": "alexpeckham", "displayName": "Alex Peckham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "That's similar to what I've been doing, except I use a wrapper view and set the width/height on those and just leave width and height of image set to Ti.UI.FILL. When I tried width as just 100% or Ti.UI.FILL with an explicit height it didn't seem to always work - this seems robust but I don't like having to use a wrapper.\r\n\r\nYes, the worst thing is I recall it did work in earlier versions of Ti and this is a regression from another bug fix. It's not ideal to have to keep fixing code that was tested and working due to API bugs :/", "updateAuthor": { "name": "alexpeckham", "key": "alexpeckham", "displayName": "Alex Peckham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-07T17:01:59.000+0000", "updated": "2014-01-07T17:01:59.000+0000" }, { "id": "290035", "author": { "name": "paul h", "key": "paul h", "displayName": "Paul Hamilton", "active": true, "timeZone": "America/Havana" }, "body": "Any chance this could get in the next release? This breaks my UI with no real work-around. The image needs to scale to the width of the screen as well as preserve aspect ratio.\r\n\r\nThe image could be smaller OR larger then the screen.", "updateAuthor": { "name": "paul h", "key": "paul h", "displayName": "Paul Hamilton", "active": true, "timeZone": "America/Havana" }, "created": "2014-01-28T19:14:34.000+0000", "updated": "2014-01-28T21:19:02.000+0000" }, { "id": "290044", "author": { "name": "paul h", "key": "paul h", "displayName": "Paul Hamilton", "active": true, "timeZone": "America/Havana" }, "body": "This stackoverflow question should be similiar to what is happening\r\n\r\nhttp://stackoverflow.com/questions/2521959/how-to-scale-an-image-in-imageview-to-keep-the-aspect-ratio\r\n\r\n{quote}\r\nIf you want an ImageView that both scales up and down while keeping the proper aspect ratio, add this to your XML:\r\n\r\nandroid:adjustViewBounds=\"true\"\r\nandroid:scaleType=\"fitCenter\"\r\nAdd this to your code:\r\n{code}\r\n// We need to adjust the height if the width of the bitmap is\r\n// smaller than the view width, otherwise the image will be boxed.\r\nfinal double viewWidthToBitmapWidthRatio = (double)image.getWidth() / (double)bitmap.getWidth();\r\nimage.getLayoutParams().height = (int) (bitmap.getHeight() * viewWidthToBitmapWidthRatio);\r\nIt took me a while to get this working, but this appears to work in the cases both where the image is smaller than the screen width and larger than the screen width, and it does not box the image.\r\n{code}\r\n{quote}", "updateAuthor": { "name": "paul h", "key": "paul h", "displayName": "Paul Hamilton", "active": true, "timeZone": "America/Havana" }, "created": "2014-01-28T19:32:03.000+0000", "updated": "2014-01-28T19:32:03.000+0000" }, { "id": "296777", "author": { "name": "ray@raymondverbruggen.nl", "key": "ray@raymondverbruggen.nl", "displayName": "Raymond Verbruggen", "active": true, "timeZone": "Europe/Berlin" }, "body": "Could you please solve this soon? This issues has already som duplicates, and is very troublesome", "updateAuthor": { "name": "ray@raymondverbruggen.nl", "key": "ray@raymondverbruggen.nl", "displayName": "Raymond Verbruggen", "active": true, "timeZone": "Europe/Berlin" }, "created": "2014-03-12T14:33:49.000+0000", "updated": "2014-03-12T14:33:49.000+0000" }, { "id": "297442", "author": { "name": "tristan559", "key": "tristan559", "displayName": "Randy Casey", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I'm having this exact problem. Spent half a day trying to figure out why my image would not scale properly. (Works fine on iOS as everyone has mentioned).\r\n\r\nWould be nice if this could be addressed in a timely manner.\r\n", "updateAuthor": { "name": "tristan559", "key": "tristan559", "displayName": "Randy Casey", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-03-16T21:39:45.000+0000", "updated": "2014-03-16T21:39:45.000+0000" }, { "id": "300683", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Updated PR with new fix.", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-04-11T17:49:51.000+0000", "updated": "2014-04-11T17:49:51.000+0000" }, { "id": "319690", "author": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "This was is incredibly annoying and not so trivial to work around - please fix, thanks.", "updateAuthor": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2014-08-21T13:01:38.000+0000", "updated": "2014-08-21T13:01:38.000+0000" }, { "id": "326317", "author": { "name": "timrichardson", "key": "timrichardson", "displayName": "Tim Richardson", "active": true, "timeZone": "America/Los_Angeles" }, "body": "How is this still not fixed!? It's ridiculously annoying", "updateAuthor": { "name": "timrichardson", "key": "timrichardson", "displayName": "Tim Richardson", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-30T10:16:59.000+0000", "updated": "2014-09-30T10:16:59.000+0000" }, { "id": "329286", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Actually, the original ticket is a duplicate of TIMOB-14395. The issue is due to a bug in the fix of TIMOB-14395 (https://github.com/appcelerator/titanium_mobile/pull/4738).", "updateAuthor": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-10-24T01:23:16.000+0000", "updated": "2014-10-24T01:26:34.000+0000" }, { "id": "329308", "author": { "name": "timrichardson", "key": "timrichardson", "displayName": "Tim Richardson", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~pwang] so if this was fixed over a year ago, why has it not been included in the latest SDK releases?!", "updateAuthor": { "name": "timrichardson", "key": "timrichardson", "displayName": "Tim Richardson", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-10-24T09:03:11.000+0000", "updated": "2014-10-24T09:03:11.000+0000" }, { "id": "329328", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "body": "It's not completely fixed one year ago because there's a bug in that fix. ", "updateAuthor": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-10-24T14:24:35.000+0000", "updated": "2014-10-24T14:24:35.000+0000" }, { "id": "329890", "author": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "Marked as resolved but not seeing the PR in 3_4_X - thanks.", "updateAuthor": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2014-10-29T05:29:28.000+0000", "updated": "2014-10-29T05:29:28.000+0000" }, { "id": "329901", "author": { "name": "kandalf", "key": "kandalf", "displayName": "Fabio", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This is not solved in the SDK 3.4.0. Please fix this annoying issue.", "updateAuthor": { "name": "kandalf", "key": "kandalf", "displayName": "Fabio", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-10-29T13:12:51.000+0000", "updated": "2014-10-29T13:12:51.000+0000" }, { "id": "329949", "author": { "name": "paul h", "key": "paul h", "displayName": "Paul Hamilton", "active": true, "timeZone": "America/Havana" }, "body": "it is marked as resolved in 3.5, have you tried a nightly build?", "updateAuthor": { "name": "paul h", "key": "paul h", "displayName": "Paul Hamilton", "active": true, "timeZone": "America/Havana" }, "created": "2014-10-29T18:30:15.000+0000", "updated": "2014-10-29T18:30:15.000+0000" }, { "id": "330131", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "3.4.X PR: https://github.com/appcelerator/titanium_mobile/pull/6293", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-10-30T21:34:56.000+0000", "updated": "2014-10-30T21:34:56.000+0000" }, { "id": "330986", "author": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "updateAuthor": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2014-11-06T05:45:38.000+0000", "updated": "2014-11-06T05:45:38.000+0000" }, { "id": "333586", "author": { "name": "vchidambaram", "key": "vchidambaram", "displayName": "Visalakshi Chidambaram", "active": true, "timeZone": "Asia/Shanghai" }, "body": "Test environment:\r\nAppc-Studio: 3.4.1.201410281743\r\nTitanium SDK: 3.5.0.v20141124155715 \r\nTitanium CLI: 3.4.1 GA\r\nAlloy : 1.5.1 GA\r\nDevice: Samsung Galaxy Tab 3 (4.4.2)", "updateAuthor": { "name": "vchidambaram", "key": "vchidambaram", "displayName": "Visalakshi Chidambaram", "active": true, "timeZone": "Asia/Shanghai" }, "created": "2014-11-25T08:44:40.000+0000", "updated": "2014-11-25T08:44:40.000+0000" }, { "id": "339096", "author": { "name": "aroyce", "key": "aroyce", "displayName": "Andrew Royce", "active": true, "timeZone": "America/New_York" }, "body": "Works for me in 3.5.0 GA\r\n\r\nTest environment:\r\nAppc-Studio: 3.4.1.201410281727\r\nTitanium SDK: 3.5.0 GA\r\nDevice: HTC One M8", "updateAuthor": { "name": "aroyce", "key": "aroyce", "displayName": "Andrew Royce", "active": true, "timeZone": "America/New_York" }, "created": "2015-01-14T20:37:13.000+0000", "updated": "2015-01-14T20:37:13.000+0000" } ], "maxResults": 24, "total": 24, "startAt": 0 } } }