Withtaker
Withtaker

Reputation: 1904

Codename One: Scale down Image with scrolling

I currently have a Logo of my app on the top of every form. Since it takes a lot of space, I want it's size to scale down the more the user scrolls down, just the way a lot of apps do it.

My Logo is currently just a container with the logo added to NORTH in the Layout. Did anyone of you already implement something similar and could give me a hint how to achieve this?

Thanks in advance.

Upvotes: 1

Views: 53

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

Check out this blog post for title animations. This is the relevant code from the post:

Form hi = new Form("Shai's Social App", new BoxLayout(BoxLayout.Y_AXIS));
for(int iter = 0 ; iter < 100 ; iter++) {
    hi.add(new Label("Social Data Goes here..."));
}
Toolbar tb = new Toolbar();
hi.setToolbar(tb);
ComponentAnimation cna = tb.createStyleAnimation("TitleAreaClean", 200);
ComponentAnimation title = tb.getTitleComponent().createStyleAnimation("TitleClean", 200);
hi.getAnimationManager().onTitleScrollAnimation(cna, title);
hi.show();

Upvotes: 1

Related Questions