codename one video placeholder in a container

Viewed 38

I would like to resize the video to play in a specific container of the form as shown in the image below...

how can I achieve this?

screenshot eample from another app

1 Answers

It depends on how you want to size the video and how you want the screen to behave on scrolling but in general size in Codename One has two factors: Layout and Preferred Size.

Preferred size is the value any Codename One component provides to indicate its desired dimension in pixels. This isn't fixed as the value changes based on font size, device density, theme etc.

For video preferred size is very problematic as the video is usually not loaded during the layout stage (and much later too if it's streamed).

Some layouts ignore the preferred size of the child for some cases (e.g. border layout center constraint, table layout where width/height is specified etc.). Those are probably the best tools to work with for most cases.

However, the simplest approach is often just overriding calcPreferredSize or invoking setPreferredSize() on the component.

Related