Effect:
:
Layout file:
Android: orientation = "vertical"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
Android: background = "# ffffff"
Android: gravity = "center"
>
Android: layout_width = "80dp"
Android: layout_height = "40dp"
Android: ellipsize = "marquee"
Android: marqueeRepeatLimit = "marquee_forever"
Android: focusable = "true"
Android: scrollHorizontally = "true"
Android: focusableInTouchMode = "true"
Android: layout_centerInParent = "true"
Android: textColor = "#0551A5"
Android: layout_marginLeft = "20dp"
Android: layout_marginRight = "20dp"
Android: singleLine = "true"/>
Java code:
Package com. example. MargueeTextView;
Import android. app. Activity;
Import android. OS. Bundle;
Import android. widget. TextView;
Public class MyActivity extends Activity {
Private TextView text1;
/**
* Called when the activity is first created.
*/
@ Override
Public void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
SetContentView (R. layout. main );
Text1 = (TextView) findViewById (R. id. text1 );
Text1.setText ("Spring is infinitely good, just near dusk .................. ");
}
}
Source code