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
dkonigs
Posts: 247
Registered: ‎07-25-2008
My Device: Bold 9900

Size ListView to just fit elements?

ListView has this tendency to consume all available vertical space that its container will allow, and also provide its own scrolling.  However, I really don't want it to do this.  What I want to do, is have a non-scrollable ListView in a Container with other elements that appear at the bottom of the list.  (I could then throw this whole Container inside its own ScrollView, of course).

 

Is there any way to do this currently?

Please use plain text.
BlackBerry Development Advisor (Retired)
mgoulet
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha
My Carrier: N/A

Re: Size ListView to just fit elements?

Hi there,

 

Have you tried inserting various layouts in your application with fixed sizes, and dropping your list view in one of them?

 

Martin

Please use plain text.
Developer
dkonigs
Posts: 247
Registered: ‎07-25-2008
My Device: Bold 9900

Re: Size ListView to just fit elements?

But that's not really what I want.  That'll give me kinda what I have now, which is a scrollable ListView in the middle of an otherwise non-scrollable page.  What I want, is for the user to be able to scroll down to the bottom of the list, and see non-ListView controls accessible below.

 

In other words, I want the ListView to behave as a control who's vertical size is dictacted by the necessary space for showing all its elements.  Not the size of its container, nor infinity, which are the only obvious options right now.

Please use plain text.
Developer
soaman
Posts: 848
Registered: ‎03-03-2011
My Device: Z10

Re: Size ListView to just fit elements?

Maybe putting container with listview into another container that dictates the layout should work.
--------------------------------------------------------------------------------------
Leader of Ljubljana BlackBerry Developer Group
BlackBerry Certified Builder for Native Application Development
Please use plain text.
BlackBerry Development Advisor (Retired)
mgoulet
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha
My Carrier: N/A

Re: Size ListView to just fit elements?

I am trying to see if you can have a ListView data model which content type would vary depending on the position on the list (different container if the last item) but I am not certain this is possible;



In this specific case, you may need to create a custom control, which contains a ListView and a container at the bottom for your buttons/other controls, whose position is a function of your ListView. You would have to manually control the vertical size of the list container as a function of the number of items in the list.

 

I will need to dig deeper. If may also be of use to log a feature request for such a component if you feel this could serve uses across the community: https://www.blackberry.com/jira/secure/Dashboard.jspa

 

Martin

 

Please use plain text.
Developer
dkonigs
Posts: 247
Registered: ‎07-25-2008
My Device: Bold 9900

Re: Size ListView to just fit elements?

Assuming I can make it work, having the ListView's size set to "height of items * number of items" would almost get me there.  (after I'm done pulling my hair out figuring out all the QML layout/model/list convolutions necessary to figure that one out)  However, I'd still need to actually have a way to *disable* the scrolling behavior of the ListView itself, or I'd have a very awkward scroll-within-a-scroll user experience.

 

I'm probably just going to have to write up a feature request ticket for this one.

 

P.S. If StandardListItem actually fired touch events, I could probably make do with a code-populated Container, and ditch ListView entirely for cases like this.  (though that's a non-ideal solution)

Please use plain text.
BlackBerry Development Advisor (Retired)
mgoulet
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha
My Carrier: N/A

Re: Size ListView to just fit elements?

Ok,

 

I will keep you posted if I come across something relevant to your case - good luck!

 

Martin

Please use plain text.
Developer
simon_hain
Posts: 16,010
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Size ListView to just fit elements?

anything new in this area?
I am using a list view as a better looking list of buttons, basically, and it does not behave nicely if there are other elements on the page
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.