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

Layout Related Question

$
0
0

Hello am new in Xamarin.am trying to create a Login Form. using the below code but i can't layout it properly.plz help me anyone asap.
i want the button and Entry field as Full width.

See the attached Image to understand what design i wants...

using System;
using Xamarin.Forms;
namespace TableConnectionPages
{
public class Login : ContentPage
{
public Login ()
{
StackLayout stk = new StackLayout ();
RelativeLayout rlv = new RelativeLayout ();
rlv.BackgroundColor = Color.Black;
Image img = new Image {
Source = "logo",
};

        Entry entry_Mail = new Entry {
            Placeholder="Email",
            HorizontalOptions = LayoutOptions.Center,
            VerticalOptions = LayoutOptions.CenterAndExpand
        };

        Entry entry_Passwor = new Entry {
            Placeholder = "Password",
            HorizontalOptions = LayoutOptions.Fill,

        };

        Button btn_Logib = new Button { 
            Text = "Log in",
            BackgroundColor = Color.Navy,
            TextColor = Color.White, 
        };
        Button btn_password = new Button { 
            Text = "Forget Password",
            BackgroundColor = Color.Navy,
            TextColor = Color.White, 
        };

        rlv.Children.Add (img ,
            Constraint.Constant(40),
            Constraint.Constant(80));

        rlv.Children.Add (entry_Mail,
            Constraint.Constant (40),
            Constraint.Constant (150));

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

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

        rlv.Children.Add (btn_password,
            Constraint.Constant(40),
            Constraint.Constant(380));

        this.Content = rlv;
    }
}

}


Viewing all articles
Browse latest Browse all 91519

Trending Articles



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