我如何在可滚动的 xaml 中制作固定位置按钮
How do i make a fixed position button in a scrollable xaml
我在 xaml 中有一个滚动视图,里面有一个网格,
<ScrollView>
<Grid>
//content
</Grid>
</ScrollView>
我想在其中添加一个按钮,该按钮出现在屏幕的右下角,并且在我上下滚动时不会移动,类似于 html 中的返回顶部固定按钮。
我曾尝试将按钮放在滚动视图之外,并将水平和垂直设置为 "END" 但即使网格不需要滚动,它也会将其置于网格内容之下,我希望它始终位于右下角的屏幕。
通过Grid
很容易实现:
<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>
结果如下:
我在 xaml 中有一个滚动视图,里面有一个网格,
<ScrollView>
<Grid>
//content
</Grid>
</ScrollView>
我想在其中添加一个按钮,该按钮出现在屏幕的右下角,并且在我上下滚动时不会移动,类似于 html 中的返回顶部固定按钮。
我曾尝试将按钮放在滚动视图之外,并将水平和垂直设置为 "END" 但即使网格不需要滚动,它也会将其置于网格内容之下,我希望它始终位于右下角的屏幕。
通过Grid
很容易实现:
<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>
结果如下: