News Ticker is a widget, that shows scrolling text running from right to left across the screen.
Click on the image below to see the demo on YouTube.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.moblin.widget.NewsTicker
android:id="@+id/news_ticker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/colorPrimary"/>
</FrameLayout>
NewsTicker ticker = (NewsTicker) findViewById(R.id.news_ticker);
ticker.setHeadlines(mHeadlines);
ticker.setListener(new NewsTicker.HeadlineClickListener() {
@Override
public void onClick(int index) {
// Index identifies the clicked headline in the list.
Toast.makeText(MainActivity.this, mHeadlines.get(index), Toast.LENGTH_SHORT)
.show();
}
});
ticker.run();