Stick Layout in Xamarin Forms to bottom

后端 未结 7 1113
星月不相逢
星月不相逢 2020-12-12 19:11

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

7条回答
  •  [愿得一人]
    2020-12-12 19:41

    Have you figured it out yet? If not, there is a few ways you could accomplish this: Note that i've got the same problem my self, but this is my theory:

    So that you could have a StackLayout in which you populate it with three "main childeren". The first could be a absolute or relative layout (I don't know the difference that well yet). In theory you should be able to add a element to the absolute layout and then add elements on top of the first element, because absolute layout uses a z-index, which works like layers in photoshop. So in other words do it like this:

    var topAbsoluteLayout = new AbsoluteLayout();
    
                topAbsoluteLayout.Children.Add(header, new Point(0, 0));
                topAbsoluteLayout.Children.Add(element1, new Point(x,y));
                topAbsoluteLayout.Children.Add(element2, new Point(x, y));
    

    Then you should do the same thing with the footer and remember to add topAbsoluteLayout to the Childeren in the StackLayout.

    I hope this helps you out

提交回复
热议问题