Android marquee textview

In this Android tip, I am going to show you how to marquee a TextView. In Android, you are not required to write java code to get the marquee animation effect on text of the TextView. You just specify some attributes of the TextView that are needed to get the marquee animation effect.

These attributes are focusable, focusableInTouchMode, ellipsize, singleLine, scrollHorizontally, and marqueeRepeatLimit. The focusable attribute controls whether the TextView can take focus. focusableInTouchMode controls whether the TextView can take focus while in touch mode. The ellipsize attribute prevents the text that is longer than the TextView from being broken in the middle. It is used with the singleLine to constrain in the text to a single line and scrollHorizontally to allow the text to be scrolled horizontally. The marqueeRepeatLimit attribute specifies the number of times the marquee animation is repeated. For example, by specifying 10 to the marqueeRepeatLimit attribute, the marquee animation repeats ten times. If you want to repeat the marquee animation infinitely, you assign -1 or constant value "marquee_forever" to the marqueeRepeatLimit attribute.

Starting the marquee animation. This is a marquee text displayed on a TextView. Ending the marquee animation"


Posted by: Dara | post date: 12-12-2014 | Subject: Android Apps Development

write programming tip

This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.