Hello Xamarin developers,
I have been struggling to create a simple horizontal scrollview with Xamarin.Forms to display a sequence of images that I can scroll through horizontally.
In the code example below, I've tried to do this by creating a ScrollView, set its Orientation to Horizontal and fill its content with a Stacklayout containing
a Label for test purposes.
var label = new Label
{
Text = "Some long text that you will have to scroll through to read",
Font = Font.SystemFontOfSize (24),
HorizontalOptions = LayoutOptions.FillAndExpand,
};
this.Content = new ScrollView
{
HorizontalOptions = LayoutOptions.Fill,
Orientation = ScrollOrientation.Horizontal,
Content = new StackLayout
{
Spacing = 10,
Children = {label }
}
};
For some reason, the view won't scroll horizontally on my android emulator and/or device. (The default vertical option works fine.)
Any thoughts would be much appreciated!