0

I'm building a Container using code and now I want to set the Styleusing one UnselectedStyle from the Resource Editor.

I'm doing this because, I don't find the way to add a LinearBackground color and a RoundBorder to my Container. When I put the two properties to the Style, the background color has gone.

So I finally add this Style using the UIManager.getInstance().addThemeProps(String name ThemeFromResource); and later the setUIID(String nameStyle). Is working fine...my Containergets the Style, but the app lose the navigation, the back Commandhas gone.

How can do this? I would like to do with my first way...creating the lineargradient and the border and adding it to the style, but I don't find the way.

Mun0n
  • 4,438
  • 4
  • 28
  • 46

1 Answers1

1

I would strongly suggest against doing that.

Border's override other forms of background, round border tries to respect some of them but is REALLY inefficient about that. It effectively draws the background on a mutable image then draws the round border on another mutable image, gets the RGB for both and performs a NOT operation to crop the background into a round image. This (as you might understand) is REALLY expensive in terms of performance, while the image is then cached it is still expensive in the longer term.

You should use image borders which are MUCH faster.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
  • Thanks for you answer Shai, I would never imagine that using image borders could be faster than build the background with style properties. – Mun0n Jul 20 '13 at 13:42
  • Its emphasized more in the How Do I? section of the Codename One project, in LWUIT we only had that fact hidden in the JavaDocs. – Shai Almog Jul 20 '13 at 18:18
  • Yes, I have build this imagesBorders and it's working fine but I have the same problem that I've said in the question, how can add this style without losing the navigation of my app? If I use addThemeProps, I lose my app navigation and if I use setThemeProps I lose the Nokia styles. – Mun0n Jul 22 '13 at 08:21
  • Sorry misread the question, guessing its a LWUIT for S40 specific issue. – Shai Almog Jul 22 '13 at 14:44
  • I find a solution. Opening the S40 themes resource, I've added the property there and now I can get access to the style. Thanks again! – Mun0n Jul 22 '13 at 15:06