--- /dev/null
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+
+#if UITEST
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls.Issues
+{
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Bugzilla, 51238,
+ "Transparent Grid causes Java.Lang.IllegalStateException: Unable to create layer for Platform_DefaultRenderer",
+ PlatformAffected.Android)]
+ public class Bugzilla51238 : TestContentPage
+ {
+#if UITEST
+ [Test]
+ public void Issue1Test()
+ {
+ RunningApp.WaitForElement("Tap Me!");
+ RunningApp.Tap("Tap Me!"); // Crashes the app if the issue isn't fixed
+ RunningApp.WaitForElement("Tap Me!");
+ }
+#endif
+
+ protected override void Init()
+ {
+ var grid = new Grid();
+ grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Star });
+ grid.RowDefinitions.Add(new RowDefinition { Height = 50 });
+
+ var transparentLayer = new Grid();
+ transparentLayer.IsVisible = false;
+ transparentLayer.BackgroundColor = Color.Lime;
+ transparentLayer.Opacity = 0.5;
+
+ var label = new Label
+ {
+ Text = "Foo",
+ HorizontalOptions = LayoutOptions.Center,
+ VerticalOptions = LayoutOptions.Center
+ };
+
+ Grid.SetRow(label, 0);
+ Grid.SetRow(transparentLayer, 0);
+
+ var button = new Button
+ {
+ Text = "Tap Me!",
+ HorizontalOptions = LayoutOptions.Center,
+ VerticalOptions = LayoutOptions.Center
+ };
+
+ Grid.SetRow(button, 1);
+
+ button.Clicked += (sender, args) => { transparentLayer.IsVisible = !transparentLayer.IsVisible; };
+
+ grid.Children.Add(label);
+ grid.Children.Add(transparentLayer);
+ grid.Children.Add(button);
+
+ Content = grid;
+ }
+ }
+}
\ No newline at end of file
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla46630.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla48236.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla47971.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla51238.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla51642.xaml.cs">
+ <DependentUpon>Bugzilla51642.xaml</DependentUpon>
+ <SubType>Code</SubType>
+ </Compile>
<Compile Include="$(MSBuildThisFileDirectory)CarouselAsync.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla34561.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla34727.cs" />
var x = (int)_context.ToPixels(view.X);
var y = (int)_context.ToPixels(view.Y);
- var width = (int)_context.ToPixels(view.Width);
- var height = (int)_context.ToPixels(view.Height);
+ var width = Math.Max(0, (int)_context.ToPixels(view.Width));
+ var height = Math.Max(0, (int)_context.ToPixels(view.Height));
var formsViewGroup = aview as FormsViewGroup;
if (formsViewGroup == null)