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


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: 30
Registered: ‎11-06-2012
My Device: BB 10 Dev Alpha
My Carrier: MegaFon

Center button inside of ScrollView

[ Edited ]

Hi All!

 

Please help me with ScrollView.

I'm trying to display a centered Button inside of Container inside of ScrollView.

 

Without ScrollView the button is centered. When I add ScrollView by uncommenting the lines below, the button becomes top-left aligned.

 

It seems that ScrollView is unable to fill available space horizontally. If I center the ScrollView it works, but dragging area is limited to button width Smiley Sad

 

Any help is very appreciated. Thanks!

 

Container {
    horizontalAlignment: HorizontalAlignment.Fill
    verticalAlignment: VerticalAlignment.Fill
    layout: StackLayout {
    }
    //ScrollView {
    //    horizontalAlignment: HorizontalAlignment.Fill
          Button {
              text: qsTr("ButtonText")
              horizontalAlignment: HorizontalAlignment.Center
          }
    //}
}

 

Developer
Posts: 222
Registered: ‎11-05-2011
My Device: Z10
My Carrier: Beeline

Re: Center button inside of ScrollView

Container {
    horizontalAlignment: HorizontalAlignment.Fill
    verticalAlignment: VerticalAlignment.Fill
    layout: StackLayout {
    }
    //ScrollView {
    //    horizontalAlignment: HorizontalAlignment.Fill
Container {
    horizontalAlignment: HorizontalAlignment.Center
    verticalAlignment: VerticalAlignment.Center
    layout: DockLayout {
    }         
          Button {
              text: qsTr("ButtonText")
              horizontalAlignment: HorizontalAlignment.Center
          }
    }
}


// try this solution

 

Developer
Posts: 222
Registered: ‎11-05-2011
My Device: Z10
My Carrier: Beeline

Re: Center button inside of ScrollView

and remove horizontal aligment from button

Highlighted
Developer
Posts: 30
Registered: ‎11-06-2012
My Device: BB 10 Dev Alpha
My Carrier: MegaFon

Re: Center button inside of ScrollView

Thanks! It still doesn't work unless ScrollView is commented out but I need the ScrollView.

 

It seems that ScrollView can't stretch to fill the enclosing container. Any other ideas?

 

New Contributor
Posts: 9
Registered: ‎11-08-2012
My Device: BB 10
My Carrier: Divum

Re: Center button inside of ScrollView

Hi,

 

Please try once using Absolute layout instead of Dock Layout. Let me know if it works.

 

ThankYou.

Developer
Posts: 30
Registered: ‎11-06-2012
My Device: BB 10 Dev Alpha
My Carrier: MegaFon

Re: Center button inside of ScrollView

[ Edited ]

Thanks for your suggestion! I tried substituting DockLayout with AbsoluteLayout but it didn't work.