03-28-2011 07:02 AM
Hi,
Am a fresher in blackberry development. I have tried changing the default blue color focus for list field in blackberry, I have found the solution. Now, I want to set the linear gradient back ground color for list field.i.e, the focus color must be linear gradient color. I have tried a lot, Am not finding the solution. Please suggest the solution for this problem
Thanks & Regards-
Rabiya
03-28-2011 09:10 AM
Take a look at Graphics.drawShadedFilledPath(), it will let you override the current selected background with your own gradient background.
03-29-2011 12:51 AM - edited 03-29-2011 02:48 AM
hi,
Thanks for reply.i am using drawShadedFilledPath but it is selecting only one listfield, remaning listfield is not selecting.i tried a lot but i did not get any solution.
here is my code......
int[] cols = new int[]{0x7FBEFF, 0x7FBEFF, 0x00FFFFFF, 0x00FFFFFF };
int[] xInds = new int[]{0, Display.getWidth(), Display.getWidth(), 0};
int[] yInds = new int[]{0, 0, listfield.getRowHeight(),listfield.getRowHeight()}
if(listfield.getSelectedIndex() == index)
{
graphics.drawShadedFilledPath(xInds, yInds,null, cols, null);
graphics.setColor(Color.BLACK);
}
listfield.invalidate(index);
please help me its very urgent.
Thanks
03-29-2011 09:17 AM
Your yInds describes the first row - that's why your gradient color affects only the first row. If you look at the drawListRow method, it has y argument - add that y to each item in yInds and you will be fine. And if you are not using that method and are overriding paint instead, you are doing it wrong.
Also, invalidate inside any kind of painting method is insanity itself - get rid of it!
03-31-2011 12:49 AM
hi,
Thanks a lot................
its working fine.
Thanks
03-31-2011 09:21 AM
Can you mark the thread as solved?