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

Adding a ScrollView to a Carousel works on iOS but not Android

$
0
0

I have a CarouselPage that contains two ScrollViews each containing a grid.

On iOS I can swipe from side to side to select a ScrollView and then that ScrollView scrolls vertically to let me see the whole grid.

On Android occasionally the carousel works but most of the time the horizontal swipe is ignored.

In the example below, the first page ( with the blue box ) always allows a swipe to switch pages while the second page ( with the red box ) will work sometimes but only intermittently.

The difference between the two is that the red box is wrapped in a ScrollView, you can even set Vertical scrolling on the ScrollView and it stills fails.

using System;
using Xamarin.Forms;

namespace MyTestApp
{
class ScrollTest : CarouselPage
{
public ScrollTest ()
{
this.Children.Add (
new ContentPage {
Content = new BoxView {
Color = Color.Blue,
WidthRequest = 150,
HeightRequest = 150,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.CenterAndExpand
}
}
);

        this.Children.Add ( 
            new ContentPage { 
                Content = new ScrollView { 
                    Orientation = ScrollOrientation.Vertical,
                    Content = new BoxView { 
                        Color = Color.Red,
                        WidthRequest = 150,
                        HeightRequest = 150,
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions = LayoutOptions.CenterAndExpand 
                    } 
                } 
            }
        );
        this.Title = "Carousel - ScrollView";
    }
}

}


Viewing all articles
Browse latest Browse all 75885

Trending Articles



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