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
Developer
Posts: 188
Registered: ‎09-03-2012
My Device: Blackberry 10
Accepted Solution

Control/Reduce space between 2 labels in StackLayout: TopToBottom

I find that there is a huge Vertical Space between 2 label in a TopToBottom stack layout.

 

Is there a way to reduce or control that space?

 

Thanks!

 

Container {
                            layout: StackLayout {
                                orientation: LayoutOrientation.TopToBottom
                            }
                            Label {
                                multiline: false
                                text: "Test Label 1"
                                verticalAlignment: VerticalAlignment.Center
                                textStyle.fontSize: FontSize.Small
                                textStyle.color: Color.DarkCyan
                                textStyle {
                                    base: SystemDefaults.TextStyles.TitleText
                                    fontWeight: FontWeight.Normal
                                    //size: 40
                                }
                            }
                            Label {
                                multiline: true
                                text: "Test Label 2"
                                verticalAlignment: VerticalAlignment.Center
                                textStyle {
                                    base: SystemDefaults.TextStyles.TitleText
                                    fontWeight: FontWeight.Normal
                                    //size: 40
                                }
                            }
                        }            

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Control/Reduce space between 2 labels in StackLayout: TopToBottom

Seems like basically the same question: http://supportforums.blackberry.com/t5/Cascades-Development/Default-padding-margin-between-elements-...

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Regular Contributor
Posts: 60
Registered: ‎12-19-2012
My Device: BB10 Alpha B
My Carrier: SFR

Re: Control/Reduce space between 2 labels in StackLayout: TopToBottom

[ Edited ]

Yes this is the exact same issue. I have tried  with other elements and there is nothing such as default padding or margin, it only occurs with Labels. So I started to believe it is some sort of font spacing that is required for special characters like ç. I have looked at what is possible with TextStyle but alhtough there is a lineHeight property, it doesn't solve the problem completly

 

EDIT : This subject has already been widely discussed here : http://supportforums.blackberry.com/t5/Cascades-Development/Alignment-and-spacing-of-Labels-in-Conta...

 

And tere is no good way to achieve this

Developer
Posts: 293
Registered: ‎10-15-2012
My Device: bb10 developer
My Carrier: Orange

Re: Control/Reduce space between 2 labels in StackLayout: TopToBottom

[ Edited ]

Put them in a DockLayout container (one at the top, the other at the bottom) and control the height of the container to control the distance between the two labels

 

Developer
Posts: 188
Registered: ‎09-03-2012
My Device: Blackberry 10

Re: Control/Reduce space between 2 labels in StackLayout: TopToBottom

I just did that also.

Works very well.

Thanks!