StackLayout透明颜色



我需要一些帮助,我想在UI底部的固定位置设置一个按钮,如何使用Xamarin.Forms?我也想在StackLayout上设置透明颜色,但没有运气。

<ScrollView>
<StackLayout>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
</StackLayout>
</ScrollView>
<StackLayout BackgroundColor="LightBlue" Opacity="0.3" Orientation="Horizontal" VerticalOptions="End">
<Button CornerRadius="30" HorizontalOptions="CenterAndExpand"  VerticalOptions="CenterAndExpand"/>
</StackLayout>

在预览器中形象它是透明的。在电话中图像

如果您想在UI底部放置一个按钮,请使用网格

<Grid Margin="10" >
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackLayout Grid.Row="0" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<ScrollView>
<StackLayout>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
<Label Text="fds"/>
</StackLayout>
</ScrollView>

</StackLayout>
<StackLayout Grid.Row="0" BackgroundColor="Transparent" HorizontalOptions="FillAndExpand" VerticalOptions="End">
<Button CornerRadius="25" VerticalOptions="End" Margin="5,0,5,0" Text="Your Button" FontSize="Small" TextColor="White" BackgroundColor="#40db7093"></Button>
</StackLayout>
</Grid>

您可以在第一个堆栈中放置任何控件。

最新更新