Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Forms-将元素绝对放置在其他内容前面的中心位置_C#_Xamarin_Xamarin.forms - Fatal编程技术网

C# Forms-将元素绝对放置在其他内容前面的中心位置

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前面放置不透明度为0.5的AbsoluteLayout和背景色,以便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