protected override void OnDraw(Android.Graphics.Canvas canvas) { if (_pages == null) { throw new Exception("Please make sure you set Pages before using this control"); } _scroller = FindViewById <HorizontalScrollView>(this.Id); _viewBody = SafeCastFirstView(_scroller.GetChildAt(0)); _viewBody.SetBackgroundColor(Android.Graphics.Color.WhiteSmoke); if (_viewBody == null) { throw new Exception("The RelativeLayout that the animation content goes in is not available. Please make sure you have a RelativeLayout within you JazzHandsHorizontalScrollView"); } int fullWidth = Resources.DisplayMetrics.WidthPixels * Pages.Value; ((Android.Widget.RelativeLayout)_scroller.GetChildAt(0)).AddView(new Android.Views.View(Context) { LayoutParameters = new LayoutParams(fullWidth, 0) }); for (int i = 0; i < Pages.Value; i++) { _pagePositions.Add(i * Resources.DisplayMetrics.WidthPixels); } // int value = (int)TypedValue.ApplyDimension (ComplexUnitType.Px, // (float)Resources.DisplayMetrics.WidthPixels * Pages, Resources.DisplayMetrics); // // ViewGroup.LayoutParams lp = new LinearLayout.LayoutParams (value, Resources.DisplayMetrics.HeightPixels); // LayoutParameters = lp; base.OnDraw(canvas); }