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: 193
Registered: ‎12-29-2010
My Device: Bold 9900
My Carrier: Rogers
Accepted Solution

list item image size

Hi,

 

Anybody know the size in the list item image? My smaller images get stretched to fill it, and the large images get shrunk to fit it. It's quite annoying since it doesn't allow any flexibility. 

 

I want an image to display in the center of the image holder in a list. But it doesn't seem possible, unless I manually create a white background with an image in it, resized to a proper size.

 

Any ideas?

 

Thanks

-G

 

Developer
Posts: 1,668
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: list item image size

using a custom list layout with ImageView doesn't help ?

try setting minwidth, maxwidth, scaling ....

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
Highlighted
Developer
Posts: 1,523
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: list item image size

I think it's better to create a custom list item. Default list item has another problem: separators between items are thick, but top and down ones are thin. Smiley Sad On system screens every item has only bottom separator.

 

Here's how I position content in custom list item:

 

        Container *imageContainer = Container::create()
                        .vertical(VerticalAlignment::Center)
                        .layout(DockLayout::create())
                        .preferredSize(121, 109)
                        .add(imageView_ = ImageView::create()
                                 .vertical(VerticalAlignment::Center)
                                 .horizontal(HorizontalAlignment::Center)
                                 );
        imageContainer->setMinWidth(121);
        imageContainer->setMinHeight(109);

        Container *imageAndContentContainer = Container::create()
                        .layout(StackLayout::create()
                        .orientation(LayoutOrientation::LeftToRight))
                        .add(imageContainer)
                        .add(contentContainer);

        Container *separatorContainer = Container::create()
                        .layout(StackLayout::create())
                        .add(imageAndContentContainer)
                        .add(Divider::create().topMargin(0).bottomMargin(0));

        Container *selectionContainer = Container::create()
                        .layout(DockLayout::create())
                        .add(separatorContainer)
                        .add(borderImageView_ = ImageView::create("asset:///images/other/selectedControlBorder.amd")
                                 .visible(false)
                                 .vertical(VerticalAlignment::Fill)
                                 .horizontal(HorizontalAlignment::Fill));

        setRoot(selectionContainer)

 


Andrey Fidrya, @zmeyc on twitter