I dynamically configure a UI and for some reason in Andriod the views don't update as expected. When the device is rotated on Andriod the PageScrollView resizes but the child view zoomable doesn't (See screenshot). It works perfectly well on IOS. I have tried calling InvalidateMeasure on PageScrollView and that doesnt help.
foreach (var formPage in currentForm.pages)
{
var layout = new FormRelativeLayoutPage();
layout.HorizontalOptions = LayoutOptions.FillAndExpand;
layout.VerticalOptions = LayoutOptions.FillAndExpand;
layout.BackgroundColor = Color.Blue;
OptimisedImage image =null;
if (formPage.image != null)
{
var img = new MemoryStream(formPage.image);
var ImageStream = new MemoryStream();
img.CopyTo(ImageStream);
img.Dispose();
var byteArray = ImageStream.ToArray();
var imageSource = ImageSource.FromStream(() => new MemoryStream(byteArray));
image = new OptimisedImage
{
Aspect = Aspect.Fill,
Source = imageSource
};
layout.Children.Add(image,
Constraint.Constant(0),
Constraint.Constant(0),
Constraint.RelativeToParent((parent) => { return parent.Width; }),
Constraint.RelativeToParent((parent) => { return parent.Height; }));
}
addControls(layout,image, formPage);
var zoomable = new ContentView()//new PinchToZoomContainer()
{
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
BackgroundColor = Color.Green,
//Content = layout
};
PageScrollView sv = new PageScrollView(currentForm)
{
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
BackgroundColor = Color.Yellow,
Content = zoomable,
PageNo = formPage.pageNo
};
pages.Add(sv);
}
CarouselViewControl cv = new CarouselViewControl
{
ItemsSource = pages//, ItemTemplate = GetDataTemplate()
,
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
Orientation= CarouselViewOrientation.Horizontal
};
cv.ShowArrows = true;
cv.ShowIndicators = true;
cv.Scrolled += Cv_Scrolled;
Content = cv
;