Auto Scroll Panel

I need a panel that automatically scrolls horizontally during operation. Just like the scrollable bottom plan that we see on television (in the news, etc.). Any idea on how to achieve this? Thanks

Edit: I found out that there are manuals and libraries, it looks like I needed the word "marquee"

+6
source share
2 answers

You need marquee , which is available on Github

+4
source

You can use the Vertical Marquee TextView library for Android with some changes.

First download the library source code and add it to your project.

Then go to the VerticalMarqueeTextView class and add a HorizontalScrollView instead of a ScrollView .

Finally, change the run method of MarqueeRunnable as such -

  @Override public void run() { final int width = textView.getWidth(); final int parentWidth = this.parent.getWidth(); if (width > 0 && parentWidth > 0 && width > parentWidth) { if (this.textView.getScrollX() >= width) { this.textView.scrollTo(-parentWidth,0 ); } else { this.textView.scrollBy(VerticalMarqueeTextView.this.unitDisplacement, 0); } this.textView.invalidate(); } } 

What is it.

He also recommended changing all "Vertical" references in the fields and methods of the library to "Horizontal" to indicate its current use.

Please note that this has not been fully tested, but it seems to work.

+1
source

All Articles