将Xamarin表单中的布局粘贴到底部 [英] Stick Layout in Xamarin Forms to bottom

查看:113
本文介绍了将Xamarin表单中的布局粘贴到底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在以Xamarin格式制作应用程序,但在将布局粘贴到设备底部时遇到一些麻烦.我以为AbsoluteLayout可以工作,但是我无法掌握它是如何工作的.因此,我制作了一个RelativeLayout,其中填充了我想填充的元素,但现在似乎无法始终将其粘贴到设备底部.

I'm making an application in Xamarin forms but I have some trouble sticking a layout to the bottom of the device. I thought an AbsoluteLayout would work, but I cannot grasp how it works. So I made a RelativeLayout which I filled with the elements I wanted to fill but now I cannot seem to get it working on sticking to the bottom of the device at all time.

下面是一个屏幕快照,希望可以使事情变得更加清晰. 我有一个stacklayout,我用headerlayout和contentlayout填充.但是,如果仅将页脚布局添加到堆栈布局中,它将不会被粘贴到页面底部,而是(从逻辑上)仅位于前一个孩子的后面.现在,我认为使用Absolutelayout可以解决问题,但我似乎无法掌握其功能及其Layoutflags和范围.有人可以帮我吗?

Below is a screenshot to make things hopefully a little bit more clear. I have a stacklayout which I fill with the headerlayout and the contentlayout. But if I just add the footerlayout to the stacklayout, it will not be sticked to the bottom of the page but (logically) just behind the previous child. Now I think an Absolutelayout would do the trick, but I cannot seem to grasp the functionality and the Layoutflags and bounds of it. Could someone help me out?

推荐答案

<StackLayout>
  <StackLayout Orientation="Horizontal" VerticalOptions="Start">
    <!-- top controls -->
  </StackLayout>

  <StackLayout VerticalOptions="CenterAndExpand">
    <!-- middle controls -->
  </StackLayout>

  <StackLayout Orientation="Horizontal" VerticalOptions="End">
    <!-- bottom controls -->
  </StackLayout>
</StackLayout>

确保不超过一个孩子具有Expand选项,以获得最佳性能.

Make sure to have no more than one child with Expand options for best performance.

这篇关于将Xamarin表单中的布局粘贴到底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆