blob: 4bce76a01bfd7f7c27696437109c7f2c9814668a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
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;
}
}
}
|