Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Relative layout with scrollview - how to autosize to display on device rotation?

$
0
0

I can't get my scrollview to resize in a relative layout on device rotation. I'm guessing it has to do with the constraints being set.

ScrollView scroll = new ScrollView();
            scroll.Content = browser;
            scroll.HorizontalOptions = new LayoutOptions { Expands = true };
            scroll.BackgroundColor = Color.Yellow;

layout.Children.Add(scroll,
                Constraint.Constant(0),
                Constraint.RelativeToView(logo, (parent, sibling) => { return sibling.Y + 70; }),
                Constraint.RelativeToParent((parent) => { return parent.Width; }),
                Constraint.RelativeToParent((parent) => { return parent.Height - 110; }));

I cannot get the scrollview to show up at all unless it's got the last 2 constraints included. What am I doing wrong?

Thanks!


Viewing all articles
Browse latest Browse all 58056

Trending Articles