C# 如何在可滚动的xaml中创建固定位置按钮

C# 如何在可滚动的xaml中创建固定位置按钮,c#,xaml,xamarin,position,fixed,C#,Xaml,Xamarin,Position,Fixed,我在xaml中有一个滚动视图,里面有一个网格 <ScrollView> <Grid> //content </Grid> </ScrollView> //内容 我想添加一个按钮somewere在那里,它出现在屏幕的右下角,并且在我上下滚动时不会移动,类似于html中的返回顶部固定按钮 我曾尝试将按钮置于scrollview之外,并将水平和垂直设置为“结束”,但它会将其置于网格内容下,即使网格不需要滚动,我希望它

我在xaml中有一个滚动视图,里面有一个网格

<ScrollView>
    <Grid>
        //content
    </Grid>
</ScrollView>

//内容
我想添加一个按钮somewere在那里,它出现在屏幕的右下角,并且在我上下滚动时不会移动,类似于html中的返回顶部固定按钮


我曾尝试将按钮置于scrollview之外,并将水平和垂直设置为“结束”,但它会将其置于网格内容下,即使网格不需要滚动,我希望它始终位于屏幕右下角。

通过
网格
很容易实现:

<Grid Margin="20">

    <ScrollView VerticalOptions="FillAndExpand">
            <Label Text="FOR the most wild,d, yet most homely narrative which I am about to pen, I neither expect nor solicit belief. Mad indeed would I be to expect it, in ad, yet most homely narrative which I am about to pen, I neither expect nor solicit belief. Mad indeed would I be to expect it, in ad, yet most homely narrative which I am about to pen, I neither expect nor solicit belief. Mad indeed would I be to expect it, in ad, yet most homely narrative which I am about to pen, I neither expect nor solicit belief. Mad indeed would I be to expect it, in ad, yet most homely narrative which I am about to pen, I neither expect nor solicit belief. Mad indeed would I be to expect it, in a yet most homely narrative which I am about to pen, I neither expect nor solicit belief. Mad indeed would I be to expect it, in a case where my very senses reject their own evidence. Yet, mad am I not -- and very surely do I not dream. But to-morrow I die, and to-day I would unburthen my soul. My immediate purpose is to place before the world, plainly, succinctly, and without comment, a series of mere household events. In their consequences, these events have terrified -- have tortured -- have destroyed me. Yet I will not attempt to expound them. To me, they have presented little but Horror -- to many they will seem less terrible than barroques. Hereafter, perhaps, some intellect may be found which will reduce my phantasm to the common-place -- some intellect more calm, more logical, and far less excitable than my own, which will perceive, in the circumstances I detail with awe, nothing more than an ordinary succession of very natural causes and effects." />
    </ScrollView>

    <Button BackgroundColor="Red" Text="Press Me" HorizontalOptions="End" VerticalOptions="End"/>

</Grid>

结果如下:


将网格添加到StackLayout中,并在StackLayout中的网格后添加按钮。您需要一个包含两行的网格。第1行包含滚动视图,第2行包含按钮