Reputation: 1916
I've begun to use LWUIT for Nokia Asha SDK 1.2 and so far I've gotten the hang of how styles work, but for elements such as FormItem I haven't found a way to do what I want.
Normally you would change the style of a Component in code like this:
component.getStyle().setBgColor(0xffffff);
But when dealing with a two-line FormItem, how can I make the font in both lines of the FormItem to be a specific size, weight, color, etc.?
If I declare a two-line FormItem like this:
FormItem item = new FormItem("First Name", "Enter first name", false);
A similar problem happens with a PopupChoiceGroup, where I try to change the background color of it, by default the background color of this component is ligh gray, but I want to make it completely white. This is how I instantiate the PopupChoiceGroup:
titleChoice = new PopupChoiceGroup(Main.localize("TITLE"), null, titleChoices, PopupChoiceGroup.SINGLE);
And I've tried the following lines to change the background color, with no success so far:
titleChoice.getSelectedStyle().setBgColor(0xffffff);
titleChoice.getUnselectedStyle().setBgColor(0xffffff);
titleChoice.getStyle().setBgTransparency(0);
titleChoice.getStyle().setBgColor(0xffffff);
How can I change the style of these components?
Upvotes: 2
Views: 82
Reputation: 3022
There does not appear to be any way to edit the fonts on the FormItem
class directly. It looks like you would have to create a custom component based on the FormItem
class, create a custom font object and draw (paint) the component using the custom font. Rather than posting the (rather long) code snippet I am including a link to this page with an example that describes the process.
Related Nokia forum post here.
The same goes for the PopupChoiceGroup class. The process to alter the background is similar.
Upvotes: 1