What is marquee in android

Android Tutorial On Textview Marquee Animation

Android Marquee Animation :

In Android when we want to display any text which should attract user’s view or any information which needs to be displayed to user we can show it by using a Android Marquee Animation.

Generally web designers may easily understand what is a marquee but for novice android developers it may take few more steps…

But today in Android Tutorial On Textview Android Marquee Animation we will discuss what is a marquee before getting on to tutorial.

Marquee is a way of making text scroll in the space provided i..e, it may be from left to right or right to left.

The simple example i want to provide is in news channels like NDTV, aaj tak, BBC news you might have observed the news is scrolling from left to right its called marquee text.

Creating MainActivity.java File

For making textview to appear in marquee animated style intitialise them and then state them as setSelected(true)

Here you can also use databinding for accessing UI Components like edittext, textviews much faster and flexiblw way too

Full Code :

Providing the full code for Android Marquee Animation implementation.

Creating activity_main.xml file

Now major part in this tutorial is in xml file, all the declarations for text to be displayed in marquee is assigned in this design. We will see it step wise first thing make your textview width “fill_parent”

should appear in single line generally marquee appear in singleline and multiple line is not a good practice and nt flexible to read multiple lines at once.

Читайте также:  Handler postdelayed android java

here ellipsize means it will place “…” if necessarywhen the textsize length increases more than expected

repeat marquee here we are repeating forever and we can also limit the count for how many times it should scroll

code for textview with all the above mentioned properties

Final Full Code :

Providing multiple textview display Android Marquee Animation as below.

Output :

This is how output for Android Tutorial On TextView Marquee Animation looks like you can alter the textviews according to your requirement and also marquee style from left to right or right to left.

Источник

Оцените статью