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
nicklas
Posts: 150
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha

ListView - alternate color lines

Hi,

 

How to get an alternate color with ListView component ?

 

Nicolas

 

BlackBerry Development Advisor (Retired)
selom
Posts: 60
Registered: ‎05-10-2012
My Device: Blackberry 10 Alpha

Re: ListView - alternate color lines

Hi Nicklas,

 

I don't think there's an easy way to accomplish this. One solution you could try is use the ListItemManager method by creating the ListItem in c++. Then for each item that is created you can alternate the background color of the item as you wish.

 

Cheers

Selom.

Developer
nicklas
Posts: 150
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha

Re: ListView - alternate color lines

Of course, but it isn't very elegant.

 

With Qt/Qml it's possible but it doesn't work with cacades.

 

Color: item.index % 2 ? red : blue

 

Nicolas

Developer
rock_win
Posts: 136
Registered: ‎02-01-2009
My Device: Not Specified

Re: ListView - alternate color lines

Since there have been lot of news of major updates coming to the ListView in the upcoming SDK version, can this also be expected to be a part of it.

Qt/QML - is very rich in features and data management
Developer
nicklas
Posts: 150
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha

Re: ListView - alternate color lines

I'll wait update with horizontal listview scroll

 

Nicolas

 

Developer
Pumano-
Posts: 215
Registered: ‎11-05-2011
My Device: Z10

Re: ListView - alternate color lines

Horizontális gallery listView also needed
Contributor
marioboikov
Posts: 30
Registered: ‎05-24-2012
My Device: Developer

Re: ListView - alternate color lines

Does background: item.index % 2 ? Color.red : Color.blue work if your item is a container?

BlackBerry Development Advisor (Retired)
gperry
Posts: 138
Registered: ‎05-11-2012
My Device: Developer

Re: ListView - alternate color lines

Niklas,

 

Have you retried this with the Beta 2 release?

 

Graham

Developer
nicklas
Posts: 150
Registered: ‎02-01-2009
My Device: Torch, PlayBook and Dev Alpha

Re: ListView - alternate color lines

Doesn't work in the last release.

 

For the moment, I add the index to my datamodel.

 

Regards,

 

Nicolas

 

BlackBerry Development Advisor (Retired)
gperry
Posts: 138
Registered: ‎05-11-2012
My Device: Developer

Re: ListView - alternate color lines

Probably the best approach in the mean time.

 

Graham