Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
Posts: 27
Registered: ‎02-28-2013
My Device: device
My Carrier: device
Accepted Solution

Login Layout

Hi,

 

I have Developed a login screen in BB10 with  two label,textfield and a button.I was tried to align the button with Horizontal.Fill but it didn't align.The following code

===============

Page {
   Container {
        background:Color.create("#c0c0")
        topPadding: 20
        Container {
	        layout: StackLayout {
	            orientation: LayoutOrientation.LeftToRight
	        }
	        Label {
	            id: label
	            leftMargin: 10
	            text: "UserName"
                verticalAlignment: VerticalAlignment.Center
            }
	        TextField {
	            id:txtFrstName
	             preferredWidth:350
	             inputMode: TextFieldInputMode.Text
                hintText: "Enter Username"
            }
         }
        Container {
            topMargin: 30
            layout: StackLayout {
                orientation: LayoutOrientation.LeftToRight
            }
            Label {
                text: "Password"
                leftMargin: 10
                verticalAlignment: VerticalAlignment.Center
            }
            TextField {
                id: txtPassword
                preferredWidth: 350
                inputMode: TextFieldInputMode.Password
                leftMargin: 30
                hintText: "Enter Password"
            }
            
        }
        Container {
            topMargin: 30
            layout: StackLayout {}
            horizontalAlignment: HorizontalAlignment.Fill
            Button {
                text: "Login"
            }
            
        }
    }
}

 Kindly give me the solution.

 

Thanks & Regards,

Venkatesan.R

 

Developer
Posts: 74
Registered: ‎03-04-2012
My Device: developer
My Carrier: developer

Re: Login Layout

Hi Venkatesan.R

Add property preferredWidth in Button to specify the area in which ur button ll span if you want button to take full screen and if required give left and right padding

hope this will help you

Regards
Deepak Charya
Developer
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: Login Layout

Change the container that the button is to be a LeftToRight orientation, and then make the button have spaceQuota: 1.0
Like all of my posts
Developer
Posts: 74
Registered: ‎03-04-2012
My Device: developer
My Carrier: developer

Re: Login Layout

To go with kylefowler suggestion use the following snippet 

 

Container {
topMargin: 30
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
leftPadding: 20
rightPadding: 20

Button {
layoutProperties: StackLayoutProperties {
spaceQuota: 1.0
}
horizontalAlignment: HorizontalAlignment.Fill
text: "Login"
}
}

Deepak Charya