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

Relative Layout

$
0
0

How can change the UI position based on screen size in relative Layout? Am using the following code.

public AccountsPage ()
{
RelativeLayout rlv = new RelativeLayout ();

        Label lbl = new Label{ 
            TextColor = Color.White,
            FontSize = Device.GetNamedSize(NamedSize.Micro,typeof(Label)),
            FontAttributes = FontAttributes.Bold,
            Text = "Table Connection is your resource for\n" +
                "direct access to some of the hottest\n" +
                "night cliubs.GOne are the days of\n" +
                "worrying about getting in,standing in\n" +
                "line,or having to know the right people\n" +
                "at the door"
        };
        Label lbl2 = new Label {
            TextColor = Color.White,
            FontSize = Device.GetNamedSize(NamedSize.Medium,typeof(Label)),
            FontAttributes = FontAttributes.Bold,
            Text = "How does the TableConnection works"
        };

        Label lbl3 = new Label {
            TextColor = Color.White,
            FontSize = Device.GetNamedSize(NamedSize.Micro,typeof(Label)),
            FontAttributes = FontAttributes.Bold,
            Text = ".     Select Your City"
        };

        Label lbl4 = new Label {
            TextColor = Color.White,
            FontSize = Device.GetNamedSize(NamedSize.Micro,typeof(Label)),
            FontAttributes = FontAttributes.Bold,
            Text = ".     Choose your club"
        };

        Label lbl5 = new Label {
            TextColor = Color.White,
            FontSize = Device.GetNamedSize(NamedSize.Micro,typeof(Label)),
            FontAttributes = FontAttributes.Bold,
            Text = ".     Pick a night/event"
        };

        Label lbl6 = new Label {
            TextColor = Color.White,
            FontSize = Device.GetNamedSize(NamedSize.Micro,typeof(Label)),
            FontAttributes = FontAttributes.Bold,
            Text = ".     Join table or book an entire table"
        };

        Label lbl7 = new Label {
            TextColor = Color.White,
            FontSize = Device.GetNamedSize(NamedSize.Micro,typeof(Label)),
            FontAttributes = FontAttributes.Bold,
            Text = ".     Placeyour Order"
        };

        Label lbl8 = new Label {
            TextColor = Color.White,
            FontSize = Device.GetNamedSize(NamedSize.Micro,typeof(Label)),
            FontAttributes = FontAttributes.Bold,
            Text = ".     Receive Conformation Email"
        };

        Label lbl9 = new Label {
            Text = "Why do you need it?",
            FontSize = Device.GetNamedSize(NamedSize.Medium ,typeof(Label)),
            FontAttributes = FontAttributes.Bold,
            TextColor = Color.White,
        };

        Label lbl10 = new Label {
            Text = "Because you want to enjoy your night\n" +
                "with out worrying about getting\n" +
                "in.TableConnection gives you the\n" +
                "power to plan a successful night out\n" +
                "with your friends,without drama.You\n" +
                "book your table directly with us,and\n" +
                "we handle everything with the club\n" +
                "directly.Don't want to book an entire\n" +
                "table?Thats why we have a join table\n" +
                "option which allows you to split the\n" +
                "cost with other club goers or your\n" +
                "friends,the decision is yours\n",
            TextColor = Color.White,
            FontSize = Device.GetNamedSize (NamedSize.Micro,typeof(Label)),
            FontAttributes = FontAttributes.Bold,
        };

        Label lbl11 = new Label {
            TextColor = Color.White,
            FontSize = Device.GetNamedSize (NamedSize.Micro,typeof(Label)),
            FontAttributes = FontAttributes.Bold,
            Text = "Terms and Conditions"
        };
        Image img = new Image{ 
            Source="faqs_image",
            VerticalOptions=LayoutOptions.FillAndExpand,
            Aspect=Aspect.Fill,
        };

        rlv.Children.Add (img,
            Constraint.Constant(0),
            Constraint.Constant(0));

        rlv.Children.Add (lbl,
            Constraint.Constant (40),
            Constraint.Constant (30));

        rlv.Children.Add (lbl2,
            Constraint.Constant(40),
            Constraint.Constant(120));

        rlv.Children.Add (lbl3,
            Constraint.Constant(40),
            Constraint.Constant(140));

        rlv.Children.Add (lbl4,
            Constraint.Constant(40),
            Constraint.Constant(160));

        rlv.Children.Add (lbl5,
            Constraint.Constant(40),
            Constraint.Constant(180));

        rlv.Children.Add (lbl6,
            Constraint.Constant(40),
            Constraint.Constant(200));

        rlv.Children.Add (lbl7,
            Constraint.Constant(40),
            Constraint.Constant(220));

        rlv.Children.Add (lbl8,
            Constraint.Constant(40),
            Constraint.Constant(240));

        rlv.Children.Add (lbl9,
            Constraint.Constant(40),
            Constraint.Constant(260));

        rlv.Children.Add (lbl10,
            Constraint.Constant (40),
            Constraint.Constant (280));

        rlv.Children.Add(lbl11,
            Constraint.Constant (70),
            Constraint.Constant(461));

        this.Content = rlv; 
    }
}

Viewing all articles
Browse latest Browse all 77050

Trending Articles



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