Maqruee Scrolling TextView In Android Widget

An Android Widget does not provide any way to get a reference to any control like a TextView. So what if you wanted a horizontal scrolling marquee TextView?

While doing it in an app is pretty easy since you can get hold of a TextView object and even doing it programmatically by giving focus to the TextView object, a widget is different. However, there is a way within the XML to make this happen.

See the XML example.

This way, whenever your widget gets called, the TextView that will display the marquee text will have focus right away and will be able to show the horizontal animating effect that you so want.

Related Posts Plugin for WordPress, Blogger...


  1. Sir,
    I have created a whole new android project using eclipse. I have placed your code exactly , but it is not working for me on both device as well as on emulator. Please guide me on this. I have placed exactly your code.

    1. @karthik: marquee doesnt work when you view in eclipse. only in emulator. wait for it. it doesnt marque right away. and also only if the text is long

  2. Is there a way to animate scrolling of the text when the text is short? Sharing of links are highly appreciated. God help me. 🙂

    1. @donnah: no. if text is short, the marquee effect will not work since the container area is wider than the text.

  3. @donnah: what you can do is program your code to make the container resize itself lesser than the text’s width. that way, the marquee will take effect.

  4. Another question, can marquee animate the text smoothly and no stopping when restarting? I only notice whenever the end of the char in the text comes, it paused for a while and continued after a while. Do you have idea on avoiding pause of the animation? I want the text animated infinitely.

    1. @donnah: maybe there is something in the api that can do that. have not crossed that scenario yet but i think there should be a method for that

  5. Ya its working. But i want multi-line marquee. I tried it a lot but couldnt found solution yet. Can you provide ma a solution for it.

    1. @raj: why would you want a multi-line marquee? makes no sense. just make multiple textviews and set them each as marquee

Leave a Reply

Your email address will not be published. Required fields are marked *