PowenKo, Android, Tutorial 010-1, UI, TextView marquee

August 22, 2011   ·   2 Comments

marquee text in android

package com.powenko.Tutorial_UI_TextView_Marquee;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class Tutorial_UI_TextView_MarqueeActivity extends Activity {
    /** Called when the activity is first created. */
	 private TextView tv;
	 
    @Override
    public 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
    }
}
<?xml version="1.0" encoding="utf-8"?>
<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:lines="1"
        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>

sample code:
Tutorial_UI_TextView_Marquee

shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter

By


Readers Comments (2)

  1. EmyWattson

    Hi, thanks for this. It works but when I changed the text with short one, for example “hello” it doesnt work. How can I do this ? please,help me.

    »
  2. admin-powenko

    sure, could you provide more information, I will love to help.

    »

You must be logged in to post a comment.

PowenKo’s Online Store

powenko_arduinoBook
Android7

Amazon

adsbygoogle

Recent Posts

Categories

Amazon