Bug 52460 - AbsoluteLayout don't adopt to different image sizes
Summary: AbsoluteLayout don't adopt to different image sizes
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.3.4
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jimmy [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-02-12 19:35 UTC by Yahav G. Bar
Modified: 2017-03-07 18:25 UTC (History)
2 users (show)

Tags: ios, absolutelayout, image
Is this bug a regression?: ---
Last known good build:


Attachments
sample project (285.73 KB, application/x-zip-compressed)
2017-03-07 18:24 UTC, Jimmy [MSFT]
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Yahav G. Bar 2017-02-12 19:35:17 UTC
# Steps to reproduce
1. Add a image to the iOS project. For instance - foo.png, foo@2x.png, foo@3x.png.
You must create all variations to get the bug.
2. Create an AbsoluteLayout. For instance:
<AbsoluteLayout BackgroundColor="Blue">
			<Image Source="home/donation-button.png"
				AbsoluteLayout.LayoutFlags="All" 
				AbsoluteLayout.LayoutBounds="0, 0, 1, 1" />
			<Label Text="Hello, World!"
					TextColor="White"
					FontAttributes="Bold"
					FontSize="16"
					AbsoluteLayout.LayoutFlags="All"
					AbsoluteLayout.LayoutBounds="0, 1, 1, 0.5" />
		</AbsoluteLayout>

# Expected behavior
Image covers the entire absolute layout, no blue color is visible.

# Actual behavior
In iPhone 6+/6s+/7+ we get the excepted behavior (to be honest, we got 1px blue rect, but I can hack it out).
In iPhone 6/6s/7 I get little blue borders.
In iPhon 5SE/5S/5- I got big blue border.

# Supplemental info (logs, images, videos)
iPhone 7+:  http://prntscr.com/e7v7x1
iPhone 7: http://prntscr.com/e7v78s
iPhone 5SE: http://prntscr.com/e7v8jm

# Test environment (full version information)
macOS Sierra 10.12.3, MacBook Pro 15" 2016, Xamarin Studio Community 6.1.5.
Comment 1 Jimmy [MSFT] 2017-02-24 22:13:42 UTC
Thank you for filing this bug report! I will try running the code you provided in the description to see if I can reproduce this issue and I will confirm and update this report as necessary.
Comment 2 Jimmy [MSFT] 2017-03-07 18:24:46 UTC
Created attachment 20184 [details]
sample project

I was able to reproduce this behavior with the sample project I am attaching. Deploying the iOS app to different simulators results in letter boxing. However the layout is in fact using the correct resolution image for the device (@2x, @3x) so I believe this is a result of the Image.Aspect property.

By default Image.Aspect is set to AspectFit which preserves its scale so letter boxing can occur. However AspectFill will make the image fill the entire view which can result in clipping: https://developer.xamarin.com/api/type/Xamarin.Forms.Aspect/

Setting the Image in the attached sample project to use AspectFill made it fill the entire layout regardless of device.