Reputation: 1865
I have a TextView with following attributes :
<TextView
android:id="@+id/appheader"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerVertical="true"
android:textColor="#ffffff"
android:layout_marginLeft="3dp"
android:textSize="21sp"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:focusable="true"
android:focusableInTouchMode="true"/>
Actually the TextView scrolls ONLY when I click the TextView. But I want to scroll it automatically when I launch the Activity. How can I do this ?
Upvotes: 1
Views: 3199
Reputation: 41
set android:scrollHorizontally="true"
for that textview.
Also set the following two properties:
text.setMovementMethod(new ScrollingMovementMethod());
text.setSelected(true);
Upvotes: 1
Reputation: 1066
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="very long text to srollll dkfjadkfjkldjfkjdkghjhtudhfjhdjfkdfkadjsajekdfjak"
android:singleLine="true"
android:marqueeRepeatLimit="marquee_forever"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"/>
Upvotes: 2
Reputation: 1182
By-default TextView
marquee effect works when it get focus. To make an automatic marquee effect you need to extend TextView
class. See this link for reference.
Upvotes: 1