Proportional change of text etc.

25 views
Skip to first unread message

Juraj Balaz

unread,
Aug 3, 2020, 9:16:38 AM8/3/20
to CodenameOne Discussions
Hi, 

I'm facing the issue with styling the application I'm working on. The style which I created looks 
different on various devices. How can I arrange the proportional chnage of text on larger screen
(see attached file, it is created on simulator ... The bigger screen the smaller text). 

When I used cn1-derive tag in css file I get repeating error message on console 
CSS> Compile of C:\projects\TestApp\css\theme.css failed
CSS> java.lang.StackOverflowError
CSS> at com.codename1.designer.css.CSSTheme$Element.getFlattenedStyle(CSSTheme.java:3166)

Thank you for your response
screens.jpg

Shai Almog

unread,
Aug 3, 2020, 10:52:42 PM8/3/20
to CodenameOne Discussions
Hi,
be careful with derive. You can create a cyclic dependency easily and trigger a failure. We suggest using it sparingly.

If you use millimeter sizes things should be fine. Notice that the sizes in pixels will be different and will look different in the simulator but on the devices they should look similar due to DPI differences between the devices.

Juraj Balaz

unread,
Aug 4, 2020, 2:09:17 AM8/4/20
to CodenameOne Discussions
Thank you ... one more question ... how can I add svg as a splash screen ... In designer from the menu information message 
pops up that this is not supported and from the right side menu panels after adding svg designer hangs. 

Shai Almog

unread,
Aug 4, 2020, 10:05:37 PM8/4/20
to CodenameOne Discussions
We support SVG through this tool: https://www.codenameone.com/blog/flamingo-svg-transcoder.html

You can also convert it to PNG or multi-image

Juraj Balaz

unread,
Aug 5, 2020, 8:23:03 AM8/5/20
to CodenameOne Discussions
I tried to convert the SVG image with tool which you recommend the first thing what I was facing 
is that the result code is uncompilable. There is part         

shape = new Rectangle2D.Double(0, 0, 128, 128);

But there is not subclass Double in Rectangle2D class. 

When I commented out this code the result doesn't looks like the original input the first thing it is not 
animated the second thing that the background is black instead of transparent. 

Shai Almog

unread,
Aug 5, 2020, 9:56:22 PM8/5/20
to CodenameOne Discussions
That tool doesn't cover the full breadth of SVG and doesn't support animations. It's mostly meant for simple things like logos and icons.
If you have an SVG animation you'd need to re-code it using graphics/components or animate it as a GIF and the animated gif cn1lib (I don't recommend that but it is the simplest approach).

Juraj Balaz

unread,
Aug 6, 2020, 3:22:16 AM8/6/20
to CodenameOne Discussions
I also tried your example on the link you reccomed earlier and the result is same 
duke.jpg

Juraj Balaz

unread,
Aug 6, 2020, 5:47:38 AM8/6/20
to CodenameOne Discussions
Where can I place the gif? I tried https://www.codenameone.com/blog/animated-gif-support.html and I added through the designer 
and also copy to package where the java file is placed and I still getting NullPointerException. 

Shai Almog

unread,
Aug 6, 2020, 10:53:41 PM8/6/20
to CodenameOne Discussions
You can place it in the src directory and open it using the / notation as is shown in the example. It shouldn't be in the designer/res file. It shouldn't be in a package.
Reply all
Reply to author
Forward
0 new messages