Customise style of Title, action button 1 and action button 2 on Nokia Asha 311
Hello All,
I'm building an app using Nokia SDK2.0 and LWUIT for Asha 311.
How can I customise the syle for the Title,action button 1 and action button 2 in terms of
- background color (action button 1, and action button 2)
- background color, font, font color for (Title)
I noticed the facebook app that came installed with Asha 311 was able to customise them to blue and facebook's font.
Thus, I would like to do the same for my app.
Re: Customise style of Title, action button 1 and action button 2 on Nokia Asha 311
Hi
you are referring to LWUIT [B]Form [/B]element components : form Title bar and form Menu bar. You can obtain them from Form by using
[I]com.sun.lwuit.Label Form.getTitleComponent() [/I]
[I]com.sun.lwuit.MenuBar Form.getMenuBar() [/I]
Then you can use [URL="http://docs.oracle.com/javame/dev-tools/lwuit-1.4/LWUIT_Developer_Guide_HTML/badggabb.html"]Style Object[/URL] to alter their appearance, check also Theming article referenced from the Style Object guide.
Re: Customise style of Title, action button 1 and action button 2 on Nokia Asha 311
Thanks for your response.
Below are the commands I used,
f.getMenuBar().getStyle().setBgColor(0xba0303);
f.getTitleComponent().getStyle().setBgColor(0xba0303);
However, the both commands did not take effect and the background color of the menu bar and title component did not change.
FYI, I am using S40-no-themes.jar for compilation.
May I know, if I should be using other ways to change background color? Thanks in advance.
Re: Customise style of Title, action button 1 and action button 2 on Nokia Asha 311
Hi ChinLoong
That is working but not for all devices : it works for Nokia 205 (201) -- these are keypad-only devices and does not work for full-touch devices as Nokia 309. My code is as the following:
[CODE]
public void startApp() {
//init the LWUIT Display
Display.init(this);
Form f = new Form("Form Title");
f.setLayout(new BorderLayout());
f.addComponent(BorderLayout.CENTER, new Label("I am a Label"));
f.addCommand(new Command("Fake1", 1));
f.addCommand(new Command("Fake1", 2));
f.addCommand(new Command("Fake2", 3));
f.addCommand(new Command("Fake3", 4));
f.getTitleComponent().getStyle().setBgColor(0xba0303);
f.getMenuBar().getStyle().setBgColor(0xba0303);
f.show();
}
[/CODE]
on keypad-only device i see colored title and menu bars.
As for Facebook app you refer to -- it is unlikelly such UI is made with LWUIT. On full-touch device there is no left button and right button softkeys but they are presented in Facebook. I guess that UI is made totally with graphics on Canvas --- please check example [URL="http://www.developer.nokia.com/Community/Wiki/How_to_use_freely_resizable_font_in_in_Java_ME"]here how push-buttons are just drawn on canvas[/URL]. class [B]Button[/B].
Regards,
Igor
Re: Customise style of Title, action button 1 and action button 2 on Nokia Asha 311
Thanks for your response, Izinin.
However, I'm not sure we are talking about the same app.
Here is the facebook app I am talking about and I think it is built by nokia( as there is nokia copyright).
[url]http://www.flickr.com/photos/84130434@N02/7978760813/in/photostream/[/url]
[url]http://www.flickr.com/photos/84130434@N02/7978759638/in/photostream/[/url]
The UI really looks very similar to a normal Series 40 SDK2.0 app, where is an action button 1, and a drop down menu after you press the action button 1.
Thus, I suspect it is not implemented using Canvas.
Re: Customise style of Title, action button 1 and action button 2 on Nokia Asha 311
Hi ChinLoong,
yes, me too suspect that this app is written with LCDUI Canvas.
you can also achieve that same thing(only status zone visible) using Nokia UI APIs
LCDUIUtil.setObjectTrait() and full screen canvas as below:
public class CustomCanvas extends Canvas
{
public customCanvas()
{
setFullScreenMode(true);
LCDUIUtil.setObjectTrait(this,
"nokia.ui.canvas.status_zone",
Boolean.TRUE);
}
}
you need to draw everything(title, header and etc) on your own.
see the documention for LCDUIUtils in Nokia UI API here:
[url]http://www.developer.nokia.com/Resources/Library/Java/_zip/GUID-237420DE-CCBE-4A74-A129-572E0708D428/com/nokia/mid/ui/LCDUIUtil.html[/url]
and in current S40 LWUIT, Form is not supported fullscreen (without status bar and title bar) mode, but in the next future release it will be fixed to available fullscreen mode.
note also that there is workaround for fullscreen form, but you might experience some other side effects. you need to test it before using it.
((GameCanvas) (javax.microedition.lcdui.Display.getDisplay(this)).getCurrent()).setFullScreenMode(true);
Re: Customise style of Title, action button 1 and action button 2 on Nokia Asha 311
[QUOTE=ChinLoong;903386]The UI really looks very similar to a normal Series 40 SDK2.0 app, where is an action button 1, and a drop down menu after you press the action button 1.
Thus, I suspect it is not implemented using Canvas.[/QUOTE]Programming and mysticism are two very different things. A full-screen Canvas can display anything.
Re: Customise style of Title, action button 1 and action button 2 on Nokia Asha 311
Thanks for your response, wizard_hu & bandarap.
I agree that with a full-screen Canvas, a developer can display anything in the app.
However, since the facebook app is built by nokia, is there anyway, we can check with the nokia team how it was implemented?
[url]http://www.flickr.com/photos/84130434@N02/7978760813/in/photostream/[/url]
[url]http://www.flickr.com/photos/84130434@N02/7978759638/in/photostream/[/url]
My additional comment is that as developer for series 40 sdk2.0, I would really prefer to use the provided
LWUIT forms, buttons and etc instead of using the Canvas(LWUIT/LCDUI) which would consume more development time.
Using the provided forms and buttons will also result in an app consistent with the Series 40 SDK2.0 general look and feel which I think is well laid out.
For example:
[url]http://www.developer.nokia.com/Resources/Library/Full_Touch/#!essentials/base-layout.html[/url]
The only extra bit, that I am looking for is to customize the background color and font of "header title" of my app which the LWUIT api already supports(I think by using the apis below).
com.sun.lwuit.Label Form.getTitleComponent()
com.sun.lwuit.MenuBar Form.getMenuBar()
Re: Customise style of Title, action button 1 and action button 2 on Nokia Asha 311
I think those APIs are not really useful in S40 version of LWUIT because underline platform doesn't allow to change Title area. if you want to decorate title area, use full screen LWUIT Form and draw your own title.
Re: Customise style of Title, action button 1 and action button 2 on Nokia Asha 311
Thanks for your response, Bandarap.
With a full screen LWUIT form, will the "action button 1" and "drop down menu" still be present in the form?
Re: Customise style of Title, action button 1 and action button 2 on Nokia Asha 311
Hi ChinLoong
That [URL="http://www.flickr.com/photos/84130434@N02/7978760813/in/photostream/"]screenshot[/URL] you have posted definitely shows LCDUI Form and button made like that way:
[CODE]
StringItem loginBtn = new StringItem(null, "Login", Item.BUTTON);
loginBtn.setDefaultCommand(Commands.OK);
[/CODE]
Check more LCDUI possibilities in [URL="https://projects.developer.nokia.com/s40uivisualisation"]that project[/URL]
Regards,
Igor
Re: Customise style of Title, action button 1 and action button 2 on Nokia Asha 311
[QUOTE]With a full screen LWUIT form, will the "action button 1" and "drop down menu" still be present in the form?[/QUOTE]
"action button 1" and "drop down menu" not present in the form. but you can implement the same look in the LWUIT form using fulltouch icons available here [url]http://www.developer.nokia.com/Resources/Library/Full_Touch/#!icon-creation/launcher-icon-basics.html[/url]
Re: Customise style of Title, action button 1 and action button 2 on Nokia Asha 311
hi bandarap
have you seen LCDUI possibilities in [URL="https://projects.developer.nokia.com/s40uivisualisation"]that project[/URL] ? --- that can be done without LWUIT --- with default minimal toolset
Re: Customise style of Title, action button 1 and action button 2 on Nokia Asha 311
Like in this photo:[URL="http://www.flickr.com/photos/84130434@N02/7978759638/in/photostream/"]http://www.flickr.com/photos/84130434@N02/7978759638/in/photostream/[/URL]
Can i display the title text in that pink color, or this is canvas form?
Re: Customise style of Title, action button 1 and action button 2 on Nokia Asha 311
[QUOTE=xtr143;907595]Like in this photo:[URL="http://www.flickr.com/photos/84130434@N02/7978759638/in/photostream/"]http://www.flickr.com/photos/84130434@N02/7978759638/in/photostream/[/URL]
Can i display the title text in that pink color, or this is canvas form?[/QUOTE]This particular screen is not a standard Java ME form (based on the content, it is unlikely a Java code at all), but you can certainly reproduce its style with manual "drawing".