0

I have textview with specific height and i have so many sentences within that textview. I have implemented scrollbar within that textview to see whole content. But i want to implement auto scroll and i am not getting the way to implement this auto scroll.

Here is my xml Layout :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
  android:layout_height="fill_parent"
  android:orientation="vertical"
  android:weightSum="1"  
  >

  <TextView 
        android:id="@+id/lyricView"
        android:layout_width="fill_parent"
        android:layout_height="250dp"       
        android:width="200dp"
        android:textStyle="bold"
        android:textColor="#ffffff"
        android:gravity="center"
        android:maxLines="16"
        android:scrollbars = "vertical"
        android:paddingTop="8dp"
        android:paddingBottom="5dp"
        android:layout_marginTop="67dp"
        android:background="#80000000"
        />

</LinearLayout>

Please help me to solve my problem. Thanx.

Zankhna
  • 4,570
  • 9
  • 62
  • 103

3 Answers3

0

I did something like this

android:text="                                     Please take your belongings after check out."
    android:singleLine="true"
    android:textColor="#000000"

    android:ellipsize="marquee"
    android:marqueeRepeatLimit="marquee_forever"
    android:layout_marginTop="150dp"
    android:scrollHorizontally="true"
    android:id="@+id/TextView03"
    android:padding="5dip" 
    android:textSize="55dp"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" />

I think the 'marquee' funda is missing........

Kunal Shah
  • 489
  • 1
  • 4
  • 21
0

an example :

public class TextViewMarquee extends Activity {
    private TextView tv;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        tv = (TextView) this.findViewById(R.id.tv);  
        tv.setSelected(true);  // Set focus to the textview
    }
}

in the XML :

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TextView
        android:id="@+id/mywidget"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:lines="1"
        android:ellipsize="marquee"
        android:fadingEdge="horizontal"
        android:marqueeRepeatLimit="marquee_forever"
        android:scrollHorizontally="true"
        android:textColor="#ff4500"
        android:text="this is a very long piece of text that will move" />
</RelativeLayout>
Vinay W
  • 9,912
  • 8
  • 41
  • 47
0

This is working for me as you needed.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayout01"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <ScrollView
        android:layout_width="wrap_content"
        android:layout_height="fill_parent" >

        <TextView
            android:id="@+id/lyricView"
            android:layout_width="200dp"
            android:layout_height="250dp"
            android:layout_marginTop="67dp"
            android:background="#80000000"
            android:scrollbars="vertical"
            android:text="@string/extra"
            android:textColor="#ffffff"
            android:textStyle="bold" />
    </ScrollView>

</LinearLayout>

If you want to hide scroll then use this android:scrollbars="none".

Chintan Khetiya
  • 15,962
  • 9
  • 47
  • 85