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.
Created attachment 15602 [details] Solution reproducing the problem. Given the following page layout for an application: AbsoluteLayout mainLayout = new AbsoluteLayout() { BackgroundColor = Color.White }; MainPage = new ContentPage { Content = mainLayout }; BoxView view = new BoxView() { Color = Color.Black }; mainLayout.Children.Add(view, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All); An approximately 1px border of white will be shown behind the BoxView, as the bounds for the BoxView are not calculated correctly for some devices. The issue appears to be related to fractional "logical" bounds for the viewport, as devices which yield a whole number for Width and Height do not exhibit the problem, while those that have fractional bounds do. For example, the Nexus 5 with a resolution of (1080 x 1776) and a density factor of 3 yields logical bounds of (360 x 592) and does **not** exhibit the problem, while the Nexus 6 with resolution of (1440 x 2392) and a density factor of 3.5 yields logical bounds of (411.42857143 x 683.42857143) and **does** exhibit the problem. It would appear then that the problem is related to an integer truncation somewhere since instead of using: mainLayout.Children.Add(view, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All); on the Nexus 6, I can use: mainLayout.Children.Add(view, new Rectangle(0, 0, 411.42857143, 683.42857143), AbsoluteLayoutFlags.PositionProportional); and the problem will **not** occur. Attached is a solution reproducing the problem.
I assume this hasn't been addressed yet?
any news on this? I'm running into the same problem. Any workaround available?
The workaround that I use is to subclass AbsoluteLayout and override the ComputeLayoutForRegion method, using the exact same code as the Xamarin.Forms implementation but *without* the Math.Round calls. I don't know if Xamarin had an explicit reason for rounding, but with this change, the content fills all available space.
Could you attach the workaround to the bug? Then I'll try and see if it fixes my issue too.
Nathan, how did you subclass and override ComputeLayoutForRegion its private? https://github.com/xamarin/Xamarin.Forms/blob/10ae30489a8b1bd096cf504c75c83c37ba9865f4/Xamarin.Forms.Core/AbsoluteLayout.cs#L213
I have added PR for this issue here, https://github.com/xamarin/Xamarin.Forms/pull/1128
Brad, my mistake - I actually override LayoutChildren to call a re-implemented version of ComputeLayoutForRegion using the changes I described above.
This will be resolved in an upcoming release https://github.com/xamarin/Xamarin.Forms/pull/1761#pullrequestreview-93231221