Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Using EasyLayout from Frank Kruger: views are only 50% of screen width - what's wrong with this?

$
0
0

This is the code from my root view controller which is using Frank's EasyLayout (from here: https://gist.github.com/praeclarum/6225853) to constrain the layout. The top, middle and bottom view are supposed to be as wide as the parent view. However, they are only 50% of it.

I don't get the issue:

public override void ViewDidLoad ()
        {
            this.View.BackgroundColor = UIColor.Yellow;
            var topView = new UIView {
                BackgroundColor = UIColor.Red
            };
            var bottomView = new UIView {
                BackgroundColor = UIColor.Blue
            };
            var middleView = new UIView {
                BackgroundColor = UIColor.Green
            };
            this.View.AddSubviews (topView, middleView, bottomView);

            this.View.ConstrainLayout (() =>
                topView.Frame.Top == this.View.Bounds.Top &&
                topView.Frame.Height == 50 &&
                topView.Frame.Width == this.View.Bounds.Width &&

                bottomView.Frame.Top == (this.View.Bounds.Bottom - 50) &&
                bottomView.Frame.Height == 50 &&
                bottomView.Frame.Width == this.View.Bounds.Width &&

                middleView.Frame.Top == topView.Bounds.Bottom &&
                middleView.Frame.Bottom == bottomView.Bounds.Top &&
                middleView.Frame.Width == this.View.Bounds.Width
            );

            foreach(var c in this.View.Constraints)
            {
                Console.WriteLine (c);
            }
        }

Viewing all articles
Browse latest Browse all 204402

Trending Articles



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