Apologies for this basic question, as I\'m a complete novice to Android:
I can make my TextView
scroll horizontally on one line.
But what I need is
refer this GitHub Project it has a wonderful example in it too.
Edit: make your xml some thing like this:
<com.package.project.VerticalMarqueeTextView
android:id="@+id/vmTextView"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/vmtvText"
android:minLines="1"
android:maxLines="10"
android:width="250dp"
android:textColor="@android:color/white"
android:textStyle="bold" />
In your activity class:
private VerticalMarqueeTextView _txtView1; //declare a member variable
In onCreate()
:
_txtView1 = (VerticalMarqueeTextView) findViewById(R.id.mTextView1);
_txtView1.setMovementMethod(new ScrollingMovementMethod());
And in other activity lifecycle methods:
@Override
protected void onResume() {
// Start or restart the Marquee if paused.
if (_txtView1.isPaused()) {
_txtView1.resumeMarquee();
}
super.onResume();
}
@Override
protected void onPause() {
// Pause the Marquee when the Activity pauses.
_txtView1.pauseMarquee();
super.onPause();
}
@Override
protected void onDestroy() {
_txtView1.stopMarquee();
super.onDestroy();
}