ScrollLayout Height Issues iOS

NPCNPC USMember ✭✭

So I have a ContentPage that goes something like this contained in a TabbedPage contained in a MasterDetailPage

<StackLayout>
            <StackLayout x:Name="PickerLayout">
            ...
            </StackLayout>

            <RelativeLayout x:Name="Relative">
                <ActivityIndicator IsVisible="{Binding Loading, Mode=TwoWay}"
                                   IsRunning="true"
                                    IsEnabled="true"
                                    x:Name="Loader"
                                   Color="Black"
                                    Scale="2"/>
                <ScrollView x:Name="Scroll">
                    <StackLayout x:Name="Stack">
                        ...
                    </StackLayout>
                </ScrollView>
            </RelativeLayout>
</StackLayout>

Then in the code behind I have this, as ScrollView Didn't like scrolling inside of a relative layout

            Relative.Children.Add(Scroll, xConstraint: Constraint.Constant(0), yConstraint: Constraint.Constant(0), widthConstraint: Constraint.RelativeToParent((parent) => { return parent.Width; }), heightConstraint: Constraint.RelativeToParent((parent) => { return parent.Height; }));
            Relative.Children.Add(Loader, xConstraint: Constraint.RelativeToParent((parent) =>
            {
                return parent.Width / 2;
            }),
            yConstraint: Constraint.RelativeToParent((parent) =>
            {
                return parent.Height / 4;
            }));

However when it gets the height from it's parent, it considers it's size to be greater than the tabs. Causing it to have a false bottom below the page so I cannot scroll all the way down.

Answers

  • JohnHardmanJohnHardman GBUniversity ✭✭✭✭✭
    edited October 6

    @NPC - Where does that code behind execute? Is it in the page constructor, in an OnAppearing() override, or somewhere else? Are you awaiting any async methods in or before the code that populates the page?

    I've raised a few bugs like this, where page content is obscured by page infrastructure such as toolbars. Typically, these show up when the page is populated somewhere other than the page constructor, and sometimes when await has been used in an override of a XF method such as OnAppearing().

    Take a look at the following, to see if what you are seeing ties up with any of these:

    https://bugzilla.xamarin.com/show_bug.cgi?id=60013 (whilst logged against UWP, it could be related to 59025 which is iOS)
    https://bugzilla.xamarin.com/show_bug.cgi?id=59025
    https://bugzilla.xamarin.com/show_bug.cgi?id=48726
    https://bugzilla.xamarin.com/show_bug.cgi?id=32213

    I don't use MasterDetailPage or TabbedPage currently, but it feels like there have been lots of issues raised against those, so if what you are seeing isn't one of the ones listed above, have a search of Bugzilla to see if you can find what you are seeing.

Sign In or Register to comment.