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
flimsy
Posts: 13
Registered: ‎04-25-2011
My Device: BlackBerry PlayBook

How to get rid of white space inside container. Setting padding and margin to 0 does not work.

Consider the following code:

import bb.cascades 1.0

Page {
 
Container {
    
	Container { 
	    background: Color.Magenta
	    topMargin: 0.0    
	    topPadding: 0.0
	    bottomMargin: 0.0
	    bottomPadding: 0.0
	    Label {
	        bottomMargin: 0.0
	        bottomPadding: 0.0
	        topMargin: 0.0    
	        topPadding: 0.0
	        text: "Row number 1"
	    }
	}
	Container { 
	    background: Color.Cyan
	    topMargin: 0.0    
	    topPadding: 0.0
	    bottomMargin: 0.0
	    bottomPadding: 0.0
	    Label {
	        topMargin: 0.0    
	        topPadding: 0.0
	        bottomMargin: 0.0
	        bottomPadding: 0.0
	        text: "Row number 2"
	    }
	}
}

 What I get (in the simulator) is empty space inside each container (see photo below):

 

 

It appears padding on left/right sides is set to 0.0 (without even specifying it in QML) but top and bottom of each container or label has extra padding... How to get rid of it so that there is no space between the two lines?

Contributor
flimsy
Posts: 13
Registered: ‎04-25-2011
My Device: BlackBerry PlayBook

Re: How to get rid of white space inside container. Setting padding and margin to 0 does not work.

Anyone? This thing is driving me craaaaaazy....

Developer
kylefowler
Posts: 526
Registered: ‎05-17-2009
My Device: 9900

Re: How to get rid of white space inside container. Setting padding and margin to 0 does not work.

Its a bug with the font and label controls, id check back with the next update. Nothing you can do about it currently.
Like all of my posts
Contributor
flimsy
Posts: 13
Registered: ‎04-25-2011
My Device: BlackBerry PlayBook

Re: How to get rid of white space inside container. Setting padding and margin to 0 does not work.

Thanks but I searched Bug Tracker for it and cannot find an entry which describes similar situation. How do you know it is a bug?

Contributor
kosh0r
Posts: 21
Registered: ‎01-22-2013
My Device: BB10 Simulator, BB10 Dev Alpha B, Playbook OS 2.1

Re: How to get rid of white space inside container. Setting padding and margin to 0 does not work.

The documentation says, that there is allways a margin of 10 pixels per side.

i hope, they will remove that...

Developer
Ebscer
Posts: 875
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha

Re: How to get rid of white space inside container. Setting padding and margin to 0 does not work.

You can set the padding to a negative value to eat away at some of this white space.

 

Obviously this opens up the possiblity of things going wrong, but if your are careful it can work...


Read my thoughts on BlackBerry Development at news.ebscer.com
Developer
Zmey
Posts: 1,514
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: How to get rid of white space inside container. Setting padding and margin to 0 does not work.

As a workaround you can also adjust Label's translationY property to move the labels closer.

Andrey Fidrya, @zmeyc on twitter
Contributor
kosh0r
Posts: 21
Registered: ‎01-22-2013
My Device: BB10 Simulator, BB10 Dev Alpha B, Playbook OS 2.1

Re: How to get rid of white space inside container. Setting padding and margin to 0 does not work.

As work arround i used an AbsoluteLayout and incremented the heigth by the buttons size. that also solved other problems, i had...