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

Layout scrolls up on changing orientation to landscape

$
0
0

Hi
I have a layout inside a scrollview.Layout contains 3 entry controls with 2 buttons. When orientation is changed, layout scrolls up very fast when I click in entry control and keyboard appears. Is there any solution to this problem? Code is as under

`Image imgLogo = new Image(){
HorizontalOptions= LayoutOptions.CenterAndExpand,
VerticalOptions= LayoutOptions.CenterAndExpand,
};
imgLogo.Source = ImageSource.FromFile ("logo.png");

        var logoLayout = new StackLayout (){VerticalOptions=LayoutOptions.StartAndExpand,Children={imgLogo}, Padding= new Thickness(0,0,0, 60)};

        var txtUserName = new ExtendedEntryControl ("Username",false){TextColor=Color.Black};
        txtUserName.SetBinding (Entry.TextProperty, "UserName");

        var txtPassword = new ExtendedEntryControl ("Password", true){TextColor=Color.Black};
        txtPassword.SetBinding(Entry.TextProperty,"Password");

        var txtenvironment = new ExtendedEntryControl ("Environment",false){TextColor=Color.Black};
        txtenvironment.SetBinding (Entry.TextProperty, "Environment");

        var controlslayout = new StackLayout{ VerticalOptions = LayoutOptions.CenterAndExpand, Spacing = 0, Children = { txtUserName,txtPassword,txtenvironment}};

        var btnSignIn = new Button { Text = "Sign In", TextColor = Color.White, BackgroundColor = Color.FromHex("#67b427"),BorderRadius=0};
        btnSignIn.SetBinding(Button.CommandProperty,"LoginCommand");

        var btnConfiguration = new Button { Text = "Configuration", TextColor = Color.White, BackgroundColor = Color.Gray,BorderRadius=0};
        btnConfiguration.SetBinding(Button.CommandProperty,"ConfigurationCommand");


        var layout = new StackLayout {
            VerticalOptions=LayoutOptions.EndAndExpand,
            Padding=new Thickness(10),
            Spacing=10,
            Children={logoLayout,this.BusyControl,controlslayout,btnSignIn,btnConfiguration}
        };
        Content = new ScrollView { Content = layout };`

Viewing all articles
Browse latest Browse all 58056

Trending Articles