First, you can use textview to implement the Scroll display in the form of a drive lamp. You only need to set two attributes for it:
Android: ellipsize = "marquee" <br/> Android: marqueerepeatlimit = "marquee_forever" <br/>
However, there is a premise that textview must be in the focus state for the scrolling display of textview. When textview loses focus, textview stops scrolling. To achieve unlimited scrolling, you also need to start with the focus. Of course, direct requestfocus () does not work. Here I use another method. It is observed that textview has a method named isfocused (). The comments in this document are as follows:
/** <Br/> * returns true if this view has focus <br/> * @ return true if this view has focus, false otherwise. <br/> */
That is to say, true is returned when textview has focus. In addition, in textview, this method is called directly as the judgment condition in many places. The most critical is that this method is declared as public! OK, the implementation method is coming soon!
The method is as follows: Define a ooxxtextview, inherit from textview, and override isfocused () method, and set its return value to true, as shown in the following example:
Public class alwaysmarqueetextview extends textview {<br/> Public alwaysmarqueetextview (context) {<br/> super (context ); <br/>}< br/> Public alwaysmarqueetextview (context, attributeset attrs) {<br/> super (context, attrs ); <br/>}< br/> Public alwaysmarqueetextview (context, attributeset attrs, int defstyle) {<br/> super (context, attrs, defstyle ); <br/>}</P> <p> @ override <br/> Public Boolean isfocused () {<br/> return true; <br/>}< br/>}