How to change Nokia full touch lwuit form header color

ぐ巨炮叔叔 提交于 2019-12-12 11:59:33

问题


I want to to change the header color of nokia lwuit based full touch form and i have tried setTitleComponent method but it is not working. Please also check the following link http://projects.developer.nokia.com/LWUIT_for_Series_40/wiki/UsingSeries40FullTouchFeatures in which it is mentioned we cannot style the header but is it means we cannot change the bgcolor as well or put custom images in the header?


回答1:


Note that when using LWUIT for Series 40 port, the default way of running LWUIT apps is a normal-size canvas in Series 40 full touch devices. Thus the Series 40 chrome shows on top of canvas. And there is no way of customising it (other than the title text).

If you want to provide branding elements to the title, the options are: 1. create an additional lable below the Series 40 headerbar 2. run the application in full-screen. We are planning to create a high-level API for this but currently it is already possible using the following trick: ((GameCanvas) (javax.microedition.lcdui.Display.getDisplay(this)).getCurrent()).setFullScreenMode(true); In the latter option you will of course lose the Series 40 full touch layout.




回答2:


Use lwuit source, you can change method visibility if required, this is example what i used to use gradient color

        form.getTitleComponent().getStyle().setBackgroundType(Style.BACKGROUND_GRADIENT_LINEAR_VERTICAL);
        form.getTitleComponent().getStyle().setBackgroundGradientEndColor(Color.GRADIENT_END);
        form.getTitleComponent().getStyle().setBackgroundGradientStartColor(Color.GRADIENT_START);
        form.getTitleComponent().getStyle().setFgColor(Color.WHITE);
        form.getTitleComponent().getStyle().setPadding(10,10,0,0);
        form.getTitleComponent().getStyle().setFont(font);

Here Color is my custom class that is used for color code, you can use your one.



来源:https://stackoverflow.com/questions/11960836/how-to-change-nokia-full-touch-lwuit-form-header-color

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!