0

I have been looking for a post to create vertical scrolling multiple textviews. similar to one shown here http://vertical-scroller.vbarsan.com/

But all post are related to creating horizontal scrolling (Marquee) textview.

Praful C
  • 162
  • 1
  • 3
  • 14
  • put the text inside textview and make the textview scrollable... – rafsanahmad007 Mar 18 '17 at 09:29
  • 2
    Possible duplicate of [Marquee text in Android](http://stackoverflow.com/questions/2182578/marquee-text-in-android) – RamithDR Mar 18 '17 at 09:30
  • do you mean text inside textView should scroll? as you have mentioned you want scrolling text not textView. or you want part of text i.e some string to scroll. – Janardhan R Mar 18 '17 at 10:14
  • sorry, its multiple textviews. I want to show a number of notifications that moves from bottom to top or vice versa – Praful C Mar 18 '17 at 10:17

4 Answers4

0
<TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:ellipsize="marquee"
            android:focusable="true"
            android:marqueeRepeatLimit="marquee_forever"/>

I hope this helps

Janwilx72
  • 502
  • 4
  • 18
0

You have 2 choice for that:

1) Use Native way: using thread, put 10 spaces before any text and in each second remove left side space and increase right space and so on, until it's limits. Hope you understood. Predefined TextView's below properties also uses this method.

2) Use predefined control TextView with below properties:

android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
Garg
  • 2,731
  • 2
  • 36
  • 47
Amit
  • 61
  • 5
0

Have main layout as ScrollView ,Create vertical LinearLayout as child of ScrollView and create (number of textview you required ) textViews inside LinearLayout.

you should change android:layout_height
as per your code

<?xml version="1.0" encoding="utf-8"?>


<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools"
   android:id="@+id/activity_main"
   android:layout_width="match_parent"
   android:layout_height="100dp"
   android:background="#FF4081"
   android:orientation="vertical">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:orientation="vertical">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:text="1st Line !" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:text="2nd line !"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:text="3rd line !" />

</LinearLayout>
</ScrollView>
Janardhan R
  • 1,541
  • 12
  • 15
-1

use this example code below it will do a marquee like html

<TextView
    android:id="@+id/mywidget"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:singleLine="true"
    android:ellipsize="marquee"
    android:fadingEdge="horizontal"
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="true"
    android:textColor="#ff4500"
    android:text="Simple application that shows how to use marquee, with a long text" />
Praful C
  • 162
  • 1
  • 3
  • 14