In Android's ApiDemo, there is a Button's revolving * effect, but if it is a TextView, there is still a little difference.
Define a revolving * (Marquee), mainly in Project/res/layout/
<SPAN style="COLOR: #993300"><TextView
android:layout_width="40px"
android:layout_height="wrap_content"
android:text="Test marquee for TextView"
android:layout_gravity="center"
android:ellipsize="marquee"
android:singleLine="true"
android:focusable="true"
android:marqueeRepeatLimit="marquee_forever"
android:focusableInTouchMode="true"
android:scrollHorizontally="true"
/></SPAN>
Key points:
(1) The length set by layout_width must be shorter than the actual length of text, that is, the text displays incomplete text will have a revolving * effect (2) ellipsize means using the revolving * marquee
(3) singleLine means single line display
(4) marqueeRepeatLimit indicates the number of times the revolving light is displayed: marquee_forever-unlimited uninterrupted display
<SPAN style="COLOR: #993300"><Button
android:
android:layout_width="320px"
android:layout_height="wrap_content"
android:text="@string/textMarquee"
android:singleLine="true"
android:focusable="true"
android:selectAllOnFocus="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
/></SPAN>
where @string/textMarquee is a string defined by /res/value/
Define a revolving * (Marquee), mainly in Project/res/layout/
Copy the codeThe code is as follows:
<SPAN style="COLOR: #993300"><TextView
android:layout_width="40px"
android:layout_height="wrap_content"
android:text="Test marquee for TextView"
android:layout_gravity="center"
android:ellipsize="marquee"
android:singleLine="true"
android:focusable="true"
android:marqueeRepeatLimit="marquee_forever"
android:focusableInTouchMode="true"
android:scrollHorizontally="true"
/></SPAN>
Key points:
(1) The length set by layout_width must be shorter than the actual length of text, that is, the text displays incomplete text will have a revolving * effect (2) ellipsize means using the revolving * marquee
(3) singleLine means single line display
(4) marqueeRepeatLimit indicates the number of times the revolving light is displayed: marquee_forever-unlimited uninterrupted display
Copy the codeThe code is as follows:
<SPAN style="COLOR: #993300"><Button
android:
android:layout_width="320px"
android:layout_height="wrap_content"
android:text="@string/textMarquee"
android:singleLine="true"
android:focusable="true"
android:selectAllOnFocus="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
/></SPAN>
where @string/textMarquee is a string defined by /res/value/