我需要一些帮助,我想在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>发布于 2020-03-25 22:52:14
如果要在UI底部放置按钮,请使用grid
<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>你可以在第一个堆栈布局中放置任何控件。
https://stackoverflow.com/questions/60849130
复制相似问题