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

Why is a horizontal scrollview consuming 80% of the vertical screen ?

$
0
0

I am using a horizontal scrollview to display a horizontal list of small icons.
However a label placed underneath the scrollview is displaced to the bottom of the screen.
I want the label to be immediately underneath the scrollview, which should place it near to the top of the screen.

I always think that an image is worth a thousand words, so below is a test, where the label "Test: 25 March" is at the bottom of the screen,
instead of being just under the 'Home' button.

Thanks for any thoughts,

Russ

` var horizontalstack = new StackLayout
{
Spacing = 0,
Orientation = StackOrientation.Horizontal,
HorizontalOptions = LayoutOptions.Start,
VerticalOptions = LayoutOptions.Start
};

            var horizontalScrollView = new ScrollView
            {
                Content = horizontalstack,
                Orientation = ScrollOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions = LayoutOptions.Start
            };

            var homeButton = new Button
            {
                Text = "Home",
                Font = Font.SystemFontOfSize(18),
                TextColor = Color.Yellow,
                BackgroundColor = Color.Black
            };

            var inviteButton = new Button
            {
                Text = "+",
                Font = Font.SystemFontOfSize(18),
                TextColor = Color.Red,
                BackgroundColor = Color.Black
            };

            horizontalstack.Children.Add(homeButton);
            horizontalstack.Children.Add(inviteButton);

            var queryLabel = new Label
            {
                Text = "Why at bottom?",
                BackgroundColor = Color.Red,
                TextColor = Color.Black,
                Font = Font.BoldSystemFontOfSize(20),
            };

            var mainStack = new StackLayout
            {
                Spacing = 0,
                Orientation = StackOrientation.Vertical
            };

            mainStack.Children.Add(horizontalScrollView);
            mainStack.Children.Add(queryLabel);
            Content = mainStack;

`


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>