C# Forms-将元素绝对放置在其他内容前面的中心位置
是否可以在StackLayout前面放置不透明度为0.5的AbsoluteLayout和背景色,以便StackLayout内容在背景中仍然可见 大概是这样的:C# Forms-将元素绝对放置在其他内容前面的中心位置,c#,xamarin,xamarin.forms,C#,Xamarin,Xamarin.forms,是否可以在StackLayout前面放置不透明度为0.5的AbsoluteLayout和背景色,以便StackLayout内容在背景中仍然可见 大概是这样的: <StackLayout> <StackLayout> <Label Text="This text needs to be visible through the AbsoluteLayout"></Label> </StackLayout>
<StackLayout>
<StackLayout>
<Label Text="This text needs to be visible through the AbsoluteLayout"></Label>
</StackLayout>
<AbsoluteLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Opacity="0.5" BackgroundColor="Blue">
<ActivityIndicator Color="White" IsRunning="true" VerticalOptions="Center" WidthRequest="20" HeightRequest="20" />
</AbsoluteLayout>
</StackLayout>
除此之外,AbsoluteLayout会阻止其他StackLayout,即使不透明度也是如此。我能做些什么让他们两个都看,一个比另一个好吗?
<Grid>
<StackLayout>
<Label Text="This text needs to be visible through the AbsoluteLayout"></Label>
</StackLayout>
<AbsoluteLayout
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
Opacity="0.5"
BackgroundColor="Blue"
InputTransparent="True">
<ActivityIndicator Color="White" IsRunning="true" VerticalOptions="Center" WidthRequest="20" HeightRequest="20" />
</AbsoluteLayout>
</Grid>
InputTransparent=“True”
将允许您点击AbsoluteLayout
,而Grid
将StackLayout
放置在AbsoluteLayout
上方(重叠)。
InputTransparent=“True”
将允许您点击绝对布局
,而网格
将堆叠布局
置于绝对布局
上方(重叠).如果要重叠,应使用网格或绝对布局作为顶级container如果要重叠,应使用网格或绝对布局作为顶级container