Think.Smart
Think.Smart

Reputation: 523

Control width render animation in Codenameone

I have a page which has multiple vertical sections, each with a thermometer type control i have built, rendered on each. How do i code it so that when the page loads that the 'mercury' width, of all the sections, can grow in an animated way to fill the thermometers?

I have tried the samples provided for making the form.animateLayout(3000); but i've been unsuccessful in getting individual controls to grow their width concurrently..

FYI the thermometer is a Container, with a Table as its Layout, with a red Label placed on the container, at a specific width

outlineContainer.add(table.createConstraint().widthPercentage(90), mercuryLabel);

This is how i guarantee the thermometer mercury is at the correct width.

Thanks in advance.

Upvotes: 1

Views: 37

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

You need to animate the direct parent of the growing element so something like this should work:

mercuryLabel.setWidth(0);
outlineContainer.animateLayout(1000);

Make sure you don't have revalidate, repaint or other related code that will disrupt this.

Upvotes: 1

Related Questions