Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Marquee text in Android

Tags:

android

How can I use marquee text in an android application?

like image 664
BIBEKRBARAL Avatar asked Feb 02 '10 08:02

BIBEKRBARAL


People also ask

What is marquee text in android?

Navigate to the app > res > layout > activity_main. xml and add the below code to that file. TextView is used here to add the text which we want to display on the screen. Here we have used android:ellipsize=”marquee” to add a marquee to our text and android:singleLine=”true” so that our text will show only in one line.

What is marquee text?

An HTML marquee is a scrolling piece of text displayed either horizontally across or vertically down your webpage depending on the settings. This is created by using HTML <marquees> tag. Note − The <marquee> tag deprecated in HTML5. Do not use this element, instead you can use JavaScript and CSS to create such effects.

What is android Ellipsize marquee?

If you want a horizontal scrollable text in your app, use android:ellipsize="marquee" where a single line large text will be scrolling.

What is editable text in android?

Android App Development for Beginners A EditText is an overlay over TextView that configures itself to be editable. It is the predefined subclass of TextView that includes rich editing capabilities.


1 Answers

Here is an example:

public class TextViewMarquee extends Activity {     private TextView tv;     @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.main);         tv = (TextView) this.findViewById(R.id.mywidget);           tv.setSelected(true);  // Set focus to the textview     } } 

The xml file with the textview:

<RelativeLayout     xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="fill_parent">     <TextView         android:id="@+id/mywidget"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignParentRight="true"         android:singleLine="true"         android:ellipsize="marquee"         android:fadingEdge="horizontal"         android:marqueeRepeatLimit="marquee_forever"         android:scrollHorizontally="true"         android:textColor="#ff4500"         android:text="Simple application that shows how to use marquee, with a long text" /> </RelativeLayout> 
like image 196
droidgren Avatar answered Sep 18 '22 04:09

droidgren