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

Java Development

Reply
Developer
Posts: 255
Registered: ‎05-03-2012
My Device: 9930
My Carrier: Vodafone

Re: ListField Focus and Background Color

What if i want to set gradient color? using BackgroundFactory.createLinearGradientBackground()?
Developer
Posts: 16,786
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: ListField Focus and Background Color

maybe you set the background to the manager instead of the listfield.
----------------------------------------------------------
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
Developer
Posts: 255
Registered: ‎05-03-2012
My Device: 9930
My Carrier: Vodafone

Re: ListField Focus and Background Color

But i want to set gradient background color to each row of list. When particular row is in focus, the color of that row should be changed.
Developer
Posts: 16,786
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: ListField Focus and Background Color

check the different methods in the graphics class for that.
the direct gradient draw is since 7.0, but you can use other methods to do it as well.
a forum search for gradient should bring up a code "sample" that you will probably need.
----------------------------------------------------------
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
Developer
Posts: 255
Registered: ‎05-03-2012
My Device: 9930
My Carrier: Vodafone

Re: ListField Focus and Background Color

[ Edited ]

Following code can be used to set gradient color to each row of list field. 
int[] cols = new int[]{0x00FDFDFD, 0x00FDFDFD, 0x00E4E4E4, 0x00E4E4E4 };
int[] xInds = new int[]{0, Display.getWidth(), Display.getWidth(), 0};
int[] yInds = new int[]{y, y, list.getRowHeight()+y,list.getRowHeight()+y};
g.drawShadedFilledPath(xInds, yInds,null, cols, null);

 

But now problem is that i am unable to view which row is in focus. How to change focus color?

Highlighted
Developer
Posts: 16,786
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: ListField Focus and Background Color

check if the row is selected
----------------------------------------------------------
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