Friday 18 May 2012

Marquee text in android

Yes it is possible to make marquee text in android using following way....

Step -1 Create Textview in xml file 

<TextView
                android:id="@+id/textView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                
                android:ellipsize="marquee"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:freezesText="true"
                android:marqueeRepeatLimit="marquee_forever"
                android:scrollHorizontally="true"
                android:singleLine="true"
     
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="#717C40"
                android:textSize="11pt"
                android:textStyle="bold"
                android:typeface="monospace" />

Step-2 in your Activity file use following code

// MARQUEE CODE FOR TEXT VIEW
        TextView tv = (TextView) this.findViewById(R.id.textView1);
        tv.setEllipsize(TruncateAt.MARQUEE);
        tv.setText("         Ronak Ashvin Pandya- macmaker.blogspot.in                              ");
        tv.setSelected(true);


its done.....Njoy Ronak Pandya

No comments: