Mike
Mike

Reputation: 369

Android - vertical scrolling?

Can anyone tell me how I might achieve automatic vertical scrolling of multiple TextViews?

I currently have a list like this :

TextView 1
TextView 2
TextView 3
TextView 4 
TextView 5

I need to show one TextView at a time in view and scroll vertically with a short delay in between each transition, then loop back to the beginning of the list..

I've tried the marquee feature of TextView and it does not allow vertical scrolling, I also tried a custom implementation of a vertical scroller but it was not flexible enough for my needs.

It is important to nest TextView controls inside so I can colour the text on each one programatically.

Any help would be much appreciated!

Upvotes: 0

Views: 752

Answers (2)

user
user

Reputation: 87064

Besides what Zsombor Erdődy-Nagy already said there is a working example in the android samples Api Demos in Views/Animation/Push.

Upvotes: 2

Zsombor Erdődy-Nagy
Zsombor Erdődy-Nagy

Reputation: 16914

Put those TextViews in a ViewFlipper and assign proper in- and out-animations for it with .setInAnimation(...) and .setOutAnimation(...), or use the respective xml attributes. You need animations that translate the contents of the ViewFlipper. In this thread, you can check out how to create translate animations.

ViewFlipper can also flip the child views automatically, or you can use the manual way by calling .setDisplayedChild(...), read the docs.

Upvotes: 3

Related Questions