6

I am developing an AppWidget where I need a TextView to display text as a marquee. I have tried using the following code (as one would do in a regular Activity), but the text does not scroll.

<TextView
    android:layout_width="150dip" 
    android:layout_height="wrap_content"
    android:text="@string/marquee_forever"
    android:singleLine="true"
    android:ellipsize="marquee"
    android:marqueeRepeatLimit="marquee_forever" />

Can anyone tell me how to fix this?

Leo
  • 537
  • 1
  • 7
  • 16

3 Answers3

4

You required to add the following properties in xml for marquee:

    android:singleLine="true" 
    android:ellipsize="marquee"
    android:marqueeRepeatLimit ="marquee_forever"
    android:scrollHorizontally="true"
    android:focusable="true"
    android:focusableInTouchMode="true"
Sandy
  • 6,285
  • 15
  • 65
  • 93
2

The marquee will appear when the content of the Textview should be larger than width.Make sure the input occupies the greater space than width.

Praveen
  • 90,477
  • 74
  • 177
  • 219
  • On an `AppWidget` the text simply does not scroll despite there being more text than can fit on the page. – Leo Oct 04 '10 at 10:56
0

The text will only scroll if the TextView is either in the selected or focused state and, as Praveen indicates, the text is wider than the available width of the TextView. I have not experimented with getting a TextView in the selected or focused states in an app widget. Perhaps this or this previous StackOverflow answers will give you some things to try.

Community
  • 1
  • 1
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491