Sudipta Som
Sudipta Som

Reputation: 6577

marquee in Android

I want to marquee the textview but am not getting success to do it properly. Though i have gone through some examples give in stackoverflow, but still having problem. can anybody help?

Upvotes: 0

Views: 1666

Answers (2)

Hisham Muneer
Hisham Muneer

Reputation: 8742

It is the minimum code to create a marque -

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

<TextView
    android:id="@+id/MarqueeText"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:ellipsize="marquee"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:scrollHorizontally="true"
    android:singleLine="true"
    android:text="This is a very long text which is not fitting in the screen so it needs to be marqueed."
    android:textAppearance="?android:attr/textAppearanceLarge" />

To make your marque more presentable view this: http://yhisham.blogspot.in/2012/08/android-how-to-make-marquee-ticker.html

Upvotes: 1

bHaRaTh
bHaRaTh

Reputation: 3514

try this it is working for me

   <TextView
                android:text="Android Marquee"
                android:id="@+id/MarqueeText" 
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" 
                android:singleLine="true"
                android:ellipsize="marquee" 
                android:marqueeRepeatLimit="marquee_forever"
                android:scrollHorizontally="true" 
                android:paddingLeft="15dip" 
                android:paddingRight="15dip" 
                android:focusable="true" 
                android:focusableInTouchMode="true" 
                android:freezesText="true">
      </TextView>

Upvotes: 3

Related Questions