locked
Error on views alignment in StackLayout RRS feed

  • Question

  • User322143 posted

    Hello,

    In Xamarin.Forms, I don't know how to start vertically alignment without space the views in the a Stacklayout.

    Here is my code:

        ...
            <ContentPage.Content>
                <AbsoluteLayout>
    
                    <StackLayout AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
                                 AbsoluteLayout.LayoutFlags="All"
                                 VerticalOptions="StartAndExpand"
                                 Padding="10, 10, 10, 10">
    
                        <TableView>
                            <TableRoot>
                                <TableSection>
        ...
                                </TableSection>
    
                            </TableRoot>
                        </TableView>
    
                        <Button Clicked="OnValidate"
                                Text="Validate"
                                Style="{StaticResource ValiderButtonStyle}" />
    
                    </StackLayout>
    
                    <StackLayout x:Name="WSActivityIndicator"
                                 Style="{StaticResource LoadingStackLayoutStyle}">
                        <ActivityIndicator Style="{StaticResource LoadingActivityIndicatorStyle}" />
                        <Label Style="{StaticResource LoadingLabelStyle}" />
                    </StackLayout>
    
                </AbsoluteLayout>
            </ContentPage.Content>
    
        </ContentPage>
    

    As you can see, the TableView isn't vertically aligned at the top and the Button is vertically aligned at the bottom instead of being at the bottom of the TableView.

    PS: I had to hide the labels on the image inserted for reasons of confidentiality

    Friday, May 19, 2017 10:02 AM

All replies

  • User283533 posted

    Hi romain, Have you tried with set spacing of stacklayout set to be zero

    Friday, May 19, 2017 12:08 PM
  • User322143 posted

    I tried to set Spacing to 0 but there is no difference

                <StackLayout AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
                             AbsoluteLayout.LayoutFlags="All"
                             VerticalOptions="StartAndExpand"
                             Padding="10, 10, 10, 10"
                             Spacing="0">
    

    Same without AbsoluteLayout properties

                <StackLayout VerticalOptions="StartAndExpand"
                             Padding="10, 10, 10, 10"
                             Spacing="0">
    

    Any idea?

    Friday, May 19, 2017 12:38 PM