Milan Baran
Milan Baran

Reputation: 4232

Codename one image component

What's the best component to include image into the layout?

I found Label to do this job. But I've problem with customizing width and height of the image.

This is the android look and feel:

enter image description here

I'd like to migrate it into CNO.So, I created custom theme to get the backgound gray and margin around container. The layout of container is TableLayout set to have 4 columns and 1 row. I'd like to see the content (image, multiline label, label, image) autoscale based on parent width and i'd like to defined components width as percentage fraction of the parent.

For now, the first image takes the width and height from icon, which is bigger that is needed. It takes a bit more space that i intend to. How can i change the image size without resizing the image resource?

enter image description here

Upvotes: 1

Views: 971

Answers (1)

Shai Almog
Shai Almog

Reputation: 52760

By default label has a small amount of padding/margin around it (and so do most components).

You can just test that this is the problem by using label.setUIID("Container") which always has 0 padding and margin (by default).

You can also edit your app theme using the designer tool and add a new UIID for Label where you can override padding/margin with 0.

Upvotes: 1

Related Questions