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

Adobe AIR Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 223
Registered: ‎04-26-2012
My Device: Z10
My Carrier: Vodafone
Accepted Solution

(bb10) center text vertically on label

Hi guys!

 

Is there a way to center vertically the text on a Label?

Suppose you have a label with heithg=200 and I want to center it vertically.

Is it possible?

My apps for Playbook: PlayEpub Book Reader with epub and FB2 support, Google Reader, ReaditLater - Net Files Share Explorer Get access to your network shared files- FFSync Sync your Firefox bookmarks and passwords
Developer
Posts: 194
Registered: ‎11-12-2010
My Device: Not Specified

Re: (bb10) center text vertically on label

[ Edited ]

I think there is no such thing as valign or so, but if you set the label's height to the actual height of the text you can then center it vertically by applying equal top and bottom margin (if you're using layoutData) or something like

myLabel.y = (availableHeight - myLabel.height) / 2  ...

 

Note that you can't get the text height until the label is rendered or at least placed in the display list (otherwise it returns 0)

myLabel.validateNow();
myLabel.height = myLabel.textHeight;

 


My app : Get set - Get up!   Get ready for the snooze revolution.

Highlighted
Developer
Posts: 223
Registered: ‎04-26-2012
My Device: Z10
My Carrier: Vodafone

Re: (bb10) center text vertically on label

Perfect! good idea, hadn't about it!

 

Thanks man

My apps for Playbook: PlayEpub Book Reader with epub and FB2 support, Google Reader, ReaditLater - Net Files Share Explorer Get access to your network shared files- FFSync Sync your Firefox bookmarks and passwords