我的CreateRegisterView函数返回我期望的结果
我的功能的最后一行
var content = new StackLayout
{
Margin = 0,
Padding = 0,
BackgroundColor = Color.Gold
};
content.Children.Add(forms);
content.Children.Add(new BoxView
{
Margin = 0,
Color = Color.Red,
VerticalOptions = LayoutOptions.FillAndExpand
});
AbsoluteLayout.SetLayoutFlags(content, AbsoluteLayoutFlags.PositionProportional);
AbsoluteLayout.SetLayoutBounds(content, new Rectangle(0f, 0f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
AbsoluteLayout.SetLayoutFlags(_ActivityIndicator, AbsoluteLayoutFlags.PositionProportional);
AbsoluteLayout.SetLayoutBounds(_ActivityIndicator, new Rectangle(0.5, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
var overlay = new AbsoluteLayout();
overlay.Children.Add(content);
overlay.Children.Add(_ActivityIndicator);
return overlay;
答案 0 :(得分:0)
我没有看到_ActivityIndicator
的任何定义。对于您所面临的问题,唯一的解释是_ActivityIndicator
在某些代码中引用了content
的相同实例。
如果不是这样,请尝试更改您的界限,摆脱AutoSize
到content
视图。
像这样:
AbsoluteLayout.SetLayoutBounds(content, new Rectangle(0f, 0f, 1f, 1f));
AbsoluteLayout.SetLayoutFlags(content, AbsoluteLayoutFlags.All);
AbsoluteLayout.SetLayoutBounds(_ActivityIndicator, new Rectangle(0.5, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
AbsoluteLayout.SetLayoutFlags(_ActivityIndicator, AbsoluteLayoutFlags.PositionProportional);